/ Published in: DOS Batch
This batch mirrors the contents of one directory to another using Robocopy. It will display a list of what is being mirrored before prompting the user for confirmation on the mirror.
WARNING: Robocopy's /MIR switch that is used in this batch WILL remove any destination objects not present in the source directory
WARNING: Robocopy's /MIR switch that is used in this batch WILL remove any destination objects not present in the source directory
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
:: mirrorp.bat :: Mirror contents of one directory to another with prompt using Robocopy :: :: Usage examples: :: mirrorp C:\source \\server\share\destination :: mirrorp D:\mydirectory "C:\directory name with spaces" :: :: Author: Karl Horky :: Date: 15 April 2010 :: Updated: 03 July 2010 (added /IS /IT /COPYALL to get NTFS permissions and date time tweaks - Thanks Chris) @echo off robocopy %_source% %_dest% /MIR /IS /IT /COPYALL /L echo. echo. set /p ans=Run mirror? [y/n]^> :copytotest echo. echo. echo Copying... robocopy %_source% %_dest% /MIR /IS /IT /COPYALL /NJS /NJH goto :eof :donothing echo No action taken. goto :eof :error echo Incorrect command usage. echo Usage: mirrorp C:\source \\server\share\destination