0
votes

I need help with my RoboCopy batch file. I have a batch file to run RoboCopy to copy file from server1 to server2. I have include the /XO switch to copy only new file.

After the file has been copied, then run the commmand against the copied file. The copy process is ok but the command failed. I don't know what am I missing here. :(

I would really appreciate for any help from the expert here. Below is my batch file:


Robocopy Job C:\ROBOCOPY\JOB2.RCJ

Created by User_Name on Mon May 06 2013 at 14:11:19

Source Directory :

   /SD:\\Server1\Projects\MS480\RSL_PR1_Data\LOFILE\    :: Source Directory.

Destination Directory :

   /DD:\\Server2\RoboCopy\Exp\  :: Destination Directory.

Include These Files :

   /IF      :: Include Files matching these names
    SystemOptions*.*

Exclude These Directories :

   /XD      :: eXclude Directories matching these names
        :: eXclude no names (currently - Command Line may override)

Exclude These Files :

   /XF      :: eXclude Files matching these names
        :: eXclude no names (currently - Command Line may override)
   /XO      :: eXclude Older files.

Copy options :

   /COPYALL     :: COPY ALL file info (equivalent to /COPY:DATSOU).
   /FFT     :: assume FAT File Times (2-second granularity).
   /ZB      :: use restartable mode; if access denied use Backup mode.

Retry Options :

   /R:5     :: number of Retries on failed copies: default 1 million.
   /W:5     :: Wait time between retries: default is 30 seconds.

Logging Options :

   /V       :: produce Verbose output, showing skipped files.
   /TS      :: include source file Time Stamps in the output.
   /FP      :: include Full Pathname of files in the output.
   /NP      :: No Progress - don't display percentage copied.
   /LOG:C:\Desktop\RoboCopy\Systemsoptions-LO-FILE.txt  :: output status to LOG file (overwrite existing log).
   /TEE     :: output to console window, as well as the log file.

@echo off



RoboCopy /JOB:job1

   SET file=SystemOptions*.*


  FOR /f %file% in (C:\Desktop\RoboCopy\Systemsoptions-LO-FILE.txt) do CrCTool.exe
 /f:%file% /a
1

1 Answers

0
votes

So you are saying that Robocopy is working as expected but you are having problems with the FOR-IN-DO command?

Try this:

    FOR /f %%b in (C:\Desktop\RoboCopy\Systemsoptions-LO-FILE.txt) do CrCTool.exe %%b /a