Folks, RoboCopy experts,
I reviewed my year old RoboCopy script to copy my user files. The old script works well, but it had multi lines, each line specifying a copy operation. The new script below has essentially a single line to copy my user folder with exclusions of what I don't want to copy. It produces a copy of the exact same GBs although the new script has been structured a bit differently (not just syntax, but also substance)
Please review, I have prepended a Glossary to make my intentions clear and to make a review easy.
Thanks!
:: Glossary for the RoboCopy script at the end of this post
::
:: ROBOCOPY.EXE reference at
robocopy
::
:: C:\Users\name = source = the entire user folder
::
:: D:\RCname = destination folder on an external backup medium, this destination folder will be created if none exists before
::
:: Now come the exclusions, the specified exclusions will not be copied
::
:: /XD "C:\Users\name\AppData" "C:\Users\name\.ms-ad" "C:\Users\name\3D Objects" This switch excludes from the source user folder the AppData folder, the .ms-ad folder, the 3D Objects folder. Note the quotation marks "..." whether they are required or not for syntax reasons
::
:: /XA:HST This switch excludes from the source user folder Hidden files, System files, Temporary files, i.e. files that are not strictly user files will not be copied
::
:: /XJ This switch excludes junction points, it covers /XJD and XJF for directories and files respectively, so that the latter switches do not have to be specified
::
:: Now come the copy options
::
:: /MIR This switch specifies a mirror of the source at the destination, the new directory tree at the destination folder will make additions, deletions and changes to an existing directory tree at the destination folder. If no directory tree exists at the destination folder, a new directory tree will be created.
::
:: /R:2 /W:0 These switches specify the number of retries and the wait time between retries in seconds
::
:: /MT:6 This switch enables multi-threaded copying with a default value of 8, but my old computer has a maximum of 8 threads, so I throttle it down to 6
::
:: Now come the logging options
::
:: /LOG:"D:\ERCLOG.txt" This switch will create a new log file at the external backup medium if none exists before, a new run will overwrite an existing log file.
::
:: /FP /BYTES /NS /NC /NFL /NDL These switches format the contents of the log file
::
:: pause Add this line to keep the command line window open
::
:: Trara, now comes the script!
ROBOCOPY.EXE C:\Users\name D:\RCname /XD "C:\Users\name\AppData" "C:\Users\name\.ms-ad" "C:\Users\name\3D Objects" /XA:HST /XJ /MIR /R:2 /W:0 /MT:6 /LOG:"D:\ERCLOG.txt" /FP /BYTES /NS /NC /NFL /NDL
pause