I've got a robocopy script running that has been only working sporadically in the past few weeks.
The Problem
- In the source directory, I'm receiving files twice a day. This script has worked for years flawlessly, but since ~December, two out of three times the script runs it ignores the files.
The Script
The goal: Copying files within a naming scheme *Identifier1*
to a UNC path, then process them with another application which moves them.
set sourcefile=D:\some\local\path\here\
set destination=\\someip\some\path\
mkdir %destination%
robocopy %sourcefile% %destination% *Identifier1* /V /R:5 /W:10 >> %Logfile%
wait 60
anotherapplication.exe
The Environment
- Fully patched Windows Server 2012R2
- Legacy batch script, not a powershell script
- I trigger the script via task scheduler with elevated rights
- User executing is a domain user with local administrative rights
- I have to use the
*Identifier*
in the script. I receive two files, one being named$Timestamp_Identifier1.csv
and the other$Timestamp_Identifier2.csv
. I only need to copy one of them.
What I've tried
- checked both file and directories permissions - the user that is running the script definitely has r/w rights. Copying manually works perfectly fine when remoting in with his credentials.
- Enabled the
/V
switch to get more output. Unfortunately, robocopy doesn't even mention the files it is ignoring in the log. - Enabled the
/R:5
and/W:10
switches to make sure it's not a load issue - Tried to let robocopy copy to a local directory first, which results in the same behaviour of "working sometimes". It's the same files that get ignored if I copy both to a local and a UNC path in the same batch.
Things worth noting
- Besides the timestamp, the files always have the same naming scheme
- There is no visible difference between files that get copied and files that don't. This includes their name and file permissions.
- The files are created in the source directory by WinSCP after downloading from a webdav-service. Log says nothing unusual.
- the
anotherapplication.exe
that I run within the same script picks the files up just fine and is indeed capable of moving them.
Any ideas or hints? As always, thanks a lot.
anotherapplication.exe
moves the file after processing it. I've added/FFT
, thanks for this hint./zb
flag.zzt
flags results first./LOG+:
to create the log instead, try running Robocopy inFOR
loop with/L
and/X
flags for log, and check the log to see of there is any pattern to when it does not list the files for copying. This is very similar to comment from @Walmart but with Robocopy.