Robocopy is a built in command line tool in Windows to copy files. when it cannot read a file because of any reason, like the file is locked or unavailable, it can retry.
Mirror a directory into anotherThis deletes destination files that are not in the original.
robocopy g:\myfiles h:\myarchive /MIR /R:2 /W:1
Copy a directory into anotherThis just copy the files.
robocopy g:\myfiles h:\myarchive /E /R:2 /W:1If you are copying junction points in Windows you may not want to follow them in order to not loop and fill up the destination. By using /MIR instead of /E files that are not in the source will be deleted from de destination.
j: mkdir backup-2018-11-27 robocopy c:\ j:\backup-2018-11-27\ /MIR /XJ /R:1 /W:1