robocopy source dest /purge /XX Will NOT delete extra files from the destination, in other words the. l, then pause first etcetera but that will be to much here I guess. As you had no file named 20201204, robocopy did nothing. In a similar vein robocopy source dest /S /mir /XX Will copy new files and folders and will not delete 'extra' files from the destination. If the difference is more than 2 seconds, robocopy will always copy all files as long as the issue with time stamping isnt solved. robocopy source dest /purge Will delete 'extra' files from the destination robocopy source dest /purge /XX Will NOT delete 'extra' files from the destination, in other words the /XX switch just turns off the effect of /Purge and returns us to the default behaviour. You can customize this code using options like Xcopy. Pick any file, copy it using robocopy, and then compare modification time of source file and destination file on the share. Rem - Finally remove the previously created variables. Xcopy "%str_SrcePath%" "%str_TrgtPath%" /d /r /v /y /h /i /s Rem Note: You can replace 'DEL /q' with 'DEL /p' for testing.įOR /f "delims=*" %%F in ('Xcopy "%str_TrgtPath%" "%str_SrcePath%" /d /r /v /y /h /i /s /l') DO IF exist "%%~F" (DEL /q /f "%%~F") ELSE (ECHO %%F deleted.)ĮCHO - Now copy only newer AND non-existing files from source to destination. Xcopy "%str_TrgtPath%" "%str_SrcePath%" /d /u /r /v /y /h /i /sĮCHO - Delete ONLY extra files from destination. Rem Note: If you DON'T want this simply remove this line OR replace /y with /-y (the /-y option will prompt you to confirm overwriting an existing file, you can also use this for testing). IF not exist "%str_SrcePath%\*.*" ECHO *** ERROR *** Source: '%1' is NOT a directory!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |