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.csvand 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
/Vswitch to get more output. Unfortunately, robocopy doesn't even mention the files it is ignoring in the log. - Enabled the
/R:5and/W:10switches 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.exethat 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.exemoves the file after processing it.I've added
– Patrick R. Jan 30 '17 at 14:43/FFT, thanks for this hint./zbflag. – harrymc Jan 30 '17 at 14:53zztflags results first. – Patrick R. Jan 30 '17 at 15:27/LOG+:to create the log instead, try running Robocopy inFORloop with/Land/Xflags 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. – tumchaaditya Jan 31 '17 at 16:07/FFT. This could be just an coincidence, so I'd like to wait at least three more days before awarding the bounty. – Patrick R. Feb 01 '17 at 10:05