How to skip existing and/or same size files when using robocopy
56,968
Do you want to exclude files of the same size, or files that haven't changed? If it's the latter, use the /XO
switch in RoboCopy to exclude files that are older than those they're being copied over.
RoboCopy "%%F" %destination% *.srt *.pdf *.mp4 *.jpg /COPYALL /XO /R:0
Author by
Arthor
I work hard with a good goal in mind :) But the world is full of so many idiots and more sheepal everyday. Never assume you know all. There is always someone better than you!!!
Updated on June 05, 2020Comments
-
Arthor almost 4 years
I have this code:
@echo on set source="R:\Contracts\" set destination="R:\Contracts\Sites" ::Not sure if this is needed ::It guarantees you have a canonical path (standard form) for %%F in (%destination%) do set destination="%%~fF" for /r %source% %%F in (.) do if "%%~fF" neq %destination% ROBOCOPY "%%F" %destination% *.srt *.pdf *.mp4 *.jpg /COPYALL /R:0 Pause
I am not sure if the code above has "SKIP commands" if file exists / or skip if file is the same size?