Related: Scheduled Robocopy task fails with 0x10 error
I'm using robocopy as part of a server backup script. It fetches the files to this workstation (Windows 7, upgraded from Vista - that caused some quirks before), and then copies them to a server in LAN (Windows Server 2000).
robocopy H:\folder \\SERVER\drive\folder /MIR /LOG:H:\backup.log /TBD /TEE
When this task runs in scheduled tasks, usually the network folder has not been accessed yet by the computer since startup. As such, it usually ends up failing:
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Fri Jul 12 16:16:03 2013
2013/07/12 16:16:03 ERROR 3 (0x00000003) Getting File System Type of Destination \\SERVER\drive\folder
The system cannot find the path specified.
Source : H:\folder
Dest - \\SERVER\drive\folder
Files : *.*
Options : *.* /TBD /TEE /S /E /COPY:DAT /PURGE /MIR /R:1000000 /W:30
------------------------------------------------------------------------------
2013/07/12 16:16:03 ERROR 3 (0x00000003) Creating Destination Directory \\SERVER\drive\folder
The system cannot find the path specified.
As you can see, I tried using /TBD switch to wait for network share names to be defined. It did not help. However, forcing the scheduled task to run manually later successfully updates all the files. Though I didn't access the server backup folder during that time, I did access a different share on the server.
What should I do? Add a retry in the batch script? Or use a different program to make sure the network path is available before continuing?
Check your permissions.
Your "manual" run , probably runs as admin , or the other way around.
As far as I can tell, in this case, the problem is the interpretation of the exit codes that Robo copy sends to Scheduled task when it finishes. Scheduled task does not like anything other than 0, but RoboCopy has exit codes ranging from 0 to 16. The reason it works for you second time is that RoboCopy returns code 0 (no changes found to files) and scheduled task "interprets" it as a correct execution (code 0). I would categorize this as another Microsoft bug.