Very Odd - Copied File Shows Immediately, Windows Stays Open
Moderator: DosItHelp
-
- Posts: 12
- Joined: 01 Nov 2012 09:19
Very Odd - Copied File Shows Immediately, Windows Stays Open
I have a real basic copy command, which is below
copy "N:\Network Folder\Some Data\TheDatabase.accdb" "C:\Development\BackEnd"
When I run this, what happens is the file shows up immediately in the "BackEnd" folder with the full file size. If I try to open it, I get a "File already in use" error, which I'm assuming is because it's not fully copied.
When I've been running this before, the file size of the copied file would keep growing. Everytime, I refreshed, the size would show as larger. This was good because I knew that it was copying. With this, the DOS window stays open with the below text
C:\MyFolder copy "N:\Network Folder\Some Data\TheDatabase.accdb" "C:\Development\BackEnd"
MyFolder is where I am running the batch file from. Does anyone know why it's doing it this way now? Also, is it actually doing something? The file normally takes about 45 minutes to copy over but I don't want to sit here and wait if it's not actually doing anything.
Any assistance would be appreciated.
copy "N:\Network Folder\Some Data\TheDatabase.accdb" "C:\Development\BackEnd"
When I run this, what happens is the file shows up immediately in the "BackEnd" folder with the full file size. If I try to open it, I get a "File already in use" error, which I'm assuming is because it's not fully copied.
When I've been running this before, the file size of the copied file would keep growing. Everytime, I refreshed, the size would show as larger. This was good because I knew that it was copying. With this, the DOS window stays open with the below text
C:\MyFolder copy "N:\Network Folder\Some Data\TheDatabase.accdb" "C:\Development\BackEnd"
MyFolder is where I am running the batch file from. Does anyone know why it's doing it this way now? Also, is it actually doing something? The file normally takes about 45 minutes to copy over but I don't want to sit here and wait if it's not actually doing anything.
Any assistance would be appreciated.
Re: Very Odd - Copied File Shows Immediately, Windows Stays
.
copy /Z c:\test.mkv d:\test.mkv
This will give you a percentage indicator for the file you are copying.
copy /Z c:\test.mkv d:\test.mkv
This will give you a percentage indicator for the file you are copying.
Re: Very Odd - Copied File Shows Immediately, Windows Stays
accesshawaii wrote:Does anyone know why it's doing it this way now?
FWIW That behaviour is normal on a network I think. The date and time stamp will not be correct though.
In later versions of Windows, on local drives, it stays at 0 bytes until finished (except for cases when the folder is updated by another process when you will get the partial filesize).
-
- Posts: 12
- Joined: 01 Nov 2012 09:19
Re: Very Odd - Copied File Shows Immediately, Windows Stays
Got it worked out. Thanks.
Another question, if you don't mind. I have done this before but cannot remember how exactly I did it. What I'm trying to do is check if a folder exists on a machine and if it doesen't then create a folder as well as sub-folders. The pseudo code would be something like the below.
If Not Exist C:\MyFolder Then
Make Folder C:\MyFolder
Make Folder C:\MyFolder\Items
Make Folder C:\MyFolder\Notes
Make Folder C:\MyFolder\Notes\Responses
Any assistance on how to do this would be appreciated. Thanks again.
Another question, if you don't mind. I have done this before but cannot remember how exactly I did it. What I'm trying to do is check if a folder exists on a machine and if it doesen't then create a folder as well as sub-folders. The pseudo code would be something like the below.
If Not Exist C:\MyFolder Then
Make Folder C:\MyFolder
Make Folder C:\MyFolder\Items
Make Folder C:\MyFolder\Notes
Make Folder C:\MyFolder\Notes\Responses
Any assistance on how to do this would be appreciated. Thanks again.
Re: Very Odd - Copied File Shows Immediately, Windows Stays
.
IF NOT EXIST C:\MyFolder\Notes\Responses MD C:\MyFolder\Notes\Responses
Even if none of the folders exist, Myfolder, Notes and Responses, will all be built.
MD = Make Directory
IF NOT EXIST C:\MyFolder\Notes\Responses MD C:\MyFolder\Notes\Responses
Even if none of the folders exist, Myfolder, Notes and Responses, will all be built.
MD = Make Directory
-
- Posts: 12
- Joined: 01 Nov 2012 09:19
Re: Very Odd - Copied File Shows Immediately, Windows Stays
That's what I needed. Thanks again.
Re: Very Odd - Copied File Shows Immediately, Windows Stays
Boombox wrote:.
IF NOT EXIST C:\MyFolder\Notes\Responses MD C:\MyFolder\Notes\Responses
Even if none of the folders exist, Myfolder, Notes and Responses, will all be built.
MD = Make Directory
You could do this - note that the trailing backslash is required for reliable testing of the existence of a folder.
if not exist "c:\myfolder\" md "C:\MyFolder\Notes\Responses"
Or just use this where the harmless error messages will be sent to nul.
MD "C:\MyFolder\Items" 2>nul
MD "C:\MyFolder\Notes\Responses" 2>nul
-
- Posts: 12
- Joined: 01 Nov 2012 09:19
Re: Very Odd - Copied File Shows Immediately, Windows Stays
Yet, another question . I'm almost done though. I'm just trying copy an entire folder and its contents, for example if I have the folder R:\MyFolder, I just want to copy that to C:\Local\MyFolder. Something that I thought would be eash but have not been able to figure it out. Below is the syntax that I'm using.
xcopy /s "R:\MyFolder\*.*" "C:\Local\MyFolder"
It's copying the contents of the folder but not the folder. I need the actual folder and its contents included. What am I doing wrong?
I do appreciate all the help.
xcopy /s "R:\MyFolder\*.*" "C:\Local\MyFolder"
It's copying the contents of the folder but not the folder. I need the actual folder and its contents included. What am I doing wrong?
I do appreciate all the help.
Re: Very Odd - Copied File Shows Immediately, Windows Stays
.
This worked for me...
You can use /y at the end too, this will overwrite existing files without prompt.
Type xcopy /? at CMD for help
This worked for me...
Code: Select all
xcopy R:\MyFolder C:\Local\MyFolder\ /e
You can use /y at the end too, this will overwrite existing files without prompt.
Type xcopy /? at CMD for help
Re: Very Odd - Copied File Shows Immediately, Windows Stays
accesshawaii wrote:xcopy /s "R:\MyFolder\*.*" "C:\Local\MyFolder"
It's copying the contents of the folder but not the folder. I need the actual folder and its contents included. What am I doing wrong?
Do you want this:
"C:\Local\MyFolder\MyFolder"