Skip to main content

Posts

Showing posts from December, 2013

Script for File copy Older than X Days | ROBOCOPY Batch file

Hey All,

Issue : One more challenge I faced yesterday.
Robocopy batch files which I scheduled were getting failed with error code 0x1

Observation : All robocopy schedules were getting failed with error code 0x1
One more thing I noticed is that the Task manager was showing multiple instances of Robocopy exe.

Task manager gave way to the solution

Solution : After googling number of forums, I found switch to exit the Robocopy at the end. I added it at the end of command, but it did not work.

It gave error 0x80 :  Quitting : /QUIT Specified on Command Line.

After that I tried one more option. Defining one more line of code and specifying the /QUIT option there.

e.g.
*****************************************************************
@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
robocopy "\\share\source" "D:\Destination" *.xml /MA…