I have two drives A and B. Using a python script I am creating some files in «A» drive and I am running a powerscript which copies all the files in the drive A to drive B in the interval of 1 sec.
I am getting this error in my powershell.
2015/03/10 23:55:35 ERROR 32 (0x00000020) Time-Stamping Destination
File \x.x.x.x\share1\source\ Dummy_100.txt The process cannot access
the file because it is being used by another process. Waiting 30
seconds…
How will I overcome this error?
Bjoern
15.9k4 gold badges43 silver badges48 bronze badges
asked Mar 10, 2015 at 18:31
if you want to skip this files you can use /r:n
that n
is times of tries
for example /w:3 /r:5
will try 5 time every 3 seconds
heck1
7145 silver badges20 bronze badges
answered Aug 28, 2019 at 6:34
This happened is because the file is locked by running process. To fix this, download Process Explorer. Then use Find>Find Handle or DLL, find out which process locked this file. Use ‘taskkill’ to kill that process in commandline. You will be fine.
answered Mar 12, 2015 at 15:17
OseackOseack
1812 silver badges5 bronze badges
4
How will I overcome this error?
If backup is, what you got in mind, and you encounter in-use files frequently, you look into Volume Shadow Copies (VSS), which allow to copy files despite them being ‘in use’. It’s not a product, but a windows technology used by various backup tool.
Sadly, it’s not built into robocopy, but can be used in conjunction with it. See
➝ https://superuser.com/a/602833/75914
and especially:
➝ https://github.com/candera/shadowspawn
answered Apr 27, 2016 at 18:46
Frank NFrank N
9,6454 gold badges81 silver badges111 bronze badges
It could be many reasons.
In my case, I was running a CMD script to copy from one server to another, a heap of SQL Server backups and transaction logs. I too had the same problem because it was trying to write into a log file that was supposedly opened by another process. It was not.
I ran many IP checks and Process ID checkers that I ran out of knowing what was hogging the log file. Event viewer said nothing.
I found out it was not even the log file that was being locked. I was able to delete it by logging into the server as a normal user with no admin privileges!
It was the backup files themselves by the SQL Server Agent. Like @Oseack said, there may have been the need to use another tool whilst the backup files themselves were still being used or locked by the SQL Server Agent.
The way I got around it was to force ROBOCOPY to wait.
/W:5
did it.
answered Aug 29, 2017 at 2:39
Fandango68Fandango68
4,5074 gold badges39 silver badges74 bronze badges
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
asked Mar 25, 2013 at 15:53
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.
answered Jun 12, 2014 at 21:52
FelixFelix
4334 silver badges8 bronze badges
2
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
answered Aug 29, 2017 at 2:48
Fandango68Fandango68
4,5074 gold badges39 silver badges74 bronze badges
3
I hope someone finds this helpful. This «fix» has worked for me several times so good luck.
Simply logout of the server with file explorer and PowerShell running… force close any apps running at the sign-out Windows page and log back into the server . Run your robocopy script and your locked process would have been released.
Sorry if it doesn’t work for you.
answered Mar 16, 2022 at 20:19
- Remove From My Forums
-
Question
-
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:
1. Why would this error be happening in the first place?
2. 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\test1Files : 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-
Moved by
Tuesday, March 26, 2013 6:40 AM
not VS Diagnostics issue. -
Moved by
Dave PatrickMVP
Wednesday, March 27, 2013 1:50 AM -
Moved by
Bill_Stewart
Wednesday, March 27, 2013 2:16 PM
Move to more appropriate forum
-
Moved by
I have two drives A and B. Using a python script I am creating some files in «A» drive and I am running a powerscript which copies all the files in the drive A to drive B in the interval of 1 sec.
I am getting this error in my powershell.
2015/03/10 23:55:35 ERROR 32 (0x00000020) Time-Stamping Destination
File \x.x.x.x\share1\source\ Dummy_100.txt The process cannot access
the file because it is being used by another process. Waiting 30
seconds…
How will I overcome this error?
Bjoern
15.9k4 gold badges43 silver badges48 bronze badges
asked Mar 10, 2015 at 18:31
if you want to skip this files you can use /r:n
that n
is times of tries
for example /w:3 /r:5
will try 5 time every 3 seconds
heck1
7145 silver badges20 bronze badges
answered Aug 28, 2019 at 6:34
This happened is because the file is locked by running process. To fix this, download Process Explorer. Then use Find>Find Handle or DLL, find out which process locked this file. Use ‘taskkill’ to kill that process in commandline. You will be fine.
answered Mar 12, 2015 at 15:17
OseackOseack
1812 silver badges5 bronze badges
4
How will I overcome this error?
If backup is, what you got in mind, and you encounter in-use files frequently, you look into Volume Shadow Copies (VSS), which allow to copy files despite them being ‘in use’. It’s not a product, but a windows technology used by various backup tool.
Sadly, it’s not built into robocopy, but can be used in conjunction with it. See
➝ https://superuser.com/a/602833/75914
and especially:
➝ https://github.com/candera/shadowspawn
answered Apr 27, 2016 at 18:46
Frank NFrank N
9,6454 gold badges81 silver badges111 bronze badges
It could be many reasons.
In my case, I was running a CMD script to copy from one server to another, a heap of SQL Server backups and transaction logs. I too had the same problem because it was trying to write into a log file that was supposedly opened by another process. It was not.
I ran many IP checks and Process ID checkers that I ran out of knowing what was hogging the log file. Event viewer said nothing.
I found out it was not even the log file that was being locked. I was able to delete it by logging into the server as a normal user with no admin privileges!
It was the backup files themselves by the SQL Server Agent. Like @Oseack said, there may have been the need to use another tool whilst the backup files themselves were still being used or locked by the SQL Server Agent.
The way I got around it was to force ROBOCOPY to wait.
/W:5
did it.
answered Aug 29, 2017 at 2:39
Fandango68Fandango68
4,5074 gold badges39 silver badges74 bronze badges
robocopy
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