A useful robocopy command

Often at work I need to copy data around and I use a niffy program called robocopy its built in to windows from at least 7 and above (not sure about vista & XP)
this is how I use it robocopy <source> <dest> /E /ZB /XJ /R:1 /W:1 /XF hiberfil.sys pagefile.sys

the robocopy needs to be run from an elevated command prompt or it will likely fail and not copy all files
below is a quick break down of the switches used above
/E copy all files and sub-folders
/ZB try to copy first if that fails use backup mode
/XJ ignore system junction points (these are like shortcut only on the disc copying these can cause recursion problems quickly filling the entire destination drive with undeletedable files)
/R:1 /W:1 Retry the copy once and wait 1 second between retrys
/XF hiberfil.sys pagefile.sys exclude the hibernation file and page file

also its worth noting robocopy can hide the destination files/folders sometimes so it may n=be necessary to run attrib -A -S -H <dest> /S /D

Leave a Reply

Your email address will not be published. Required fields are marked *