Thanks in advance for your help.
I am using ROBOCOPY
to copy some files from on drive to another on the same computer. Every once in awhile, I get an error. And instead of retrying 999 times as it should, it retries once and fails. I have a couple questions:
Why would this error be happening in the first place?
Why isn't ROBOCOPY
retrying the 999 times as defined?
Commands are below:
mkdir C:\Users\tempuser\AppData\Local\temp\test1
robocopy /R:999 /W:5 /NP /E /XO /NFL /NDL E:\test1 C:\Users\tempuser\AppData\Local\temp\test1 test*
------------------------------------------------------------------------------- ROBOCOPY :: Robust File Copy for Windows ------------------------------------------------------------------------------- Started : Monday, March 25, 2013 4:20:51 AM Source : E:\test1 Dest : C:\Users\tempuser\AppData\Local\temp\test1 Files : test* Options : /NDL /NFL /S /E /DCOPY:DA /COPY:DAT /NP /XO /R:999 /W:5 ------------------------------------------------------------------------------ 2013/03/25 04:20:51 ERROR 32 (0x00000020) Accessing Destination Directory C:\Users\tempuser\AppData\Local\temp\test1 The process cannot access the file because it is being used by another process. Waiting 5 seconds... Retrying... ------------------------------------------------------------------------------ Total Copied Skipped Mismatch FAILED Extras Dirs : 1 0 0 0 1 0 Files : 0 0 0 0 0 0 Bytes : 0 0 0 0 0 0 Times : 0:00:05 0:00:00 0:00:05 0:00:00 Ended : Monday, March 25, 2013 4:20:56 AM
This is quite probably a bug in robocopy. It has at least one other bug surrounding Error 32 / in use files: /b (backup) mode will fail with this error even if a file is not exclusively locked (and is copyable with 'copy', 'xcopy', windows explorer, and robocopy without /b), so I suspect there are bugs in how it handles in-use files in general.
There is no "bug" in ROBOCOPY.
Something is "locking" your source folders and files from time-to-time. Not always, as that's proof based on the fact that your copies work "at times".
I would place a script to copy "out" your source files into another location (drive preferably), and then use ROBOCOPY from that new location into your other or final location. Use the move option to keep the intermediate location free for the next backups, etc.
I use this...
robocopy <source path> <target path> <files> /s /j /r:2 /w:5 /log+:robocopy.log
User contributions licensed under CC BY-SA 3.0