ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

Robocopy Script Experts



  E39 530i
Need some help please.

What is the correct syntax to use to get RoboCopy to copy all new and changed files from one location to another. What I need to do is to copy all new and changed files and folders, including hidden and empty folders from one server to another. I'll be doing an initial manual copy of the directory to an external drive, so will need to capture the changes back to the external drive.

If the file exists on the source but not on the destination, then the file would be copied to the destination.

If the file exists on both then the file from the source should overwrite the file in the destination ONLY if the file on the source is newer, otherwise no action.

If the file exists on the destination but not on the source then it should update the destination with the new changes from the source. (but not copied to the source).

If that makes sense
 
Hope this helps....

ROBOCOPY <source dir> <target dir> /E /XO /XC

Should do the first 3 paragraphs. /E will copy empty directories, /XO will eXclude Older files, and /XC will eXclude Changed (same times, different sizes). Just new files or newer files will be copied. It is unusual to need /XC but I thought it best to mention it.

Paragraph 4 is not clear. If a file exists on the destination but not the source, the default is to leave it there in the destination. If you want to delete such files so that the destination directory mirrors the source directory, then add /PURGE.

Note: Be very careful when using /PURGE – if you point Robocopy at the wrong destination with /PURGE specified it will delete a LOT of data, with no way to recover it.

I would recommend getting things working and in sync without /purge initially, and then add it with /L first to make sure that there aren’t too many “Extra” files and directories that would be deleted. Then Remove /L when you are absolutely sure the Robocopy job is working as you want it.
 


Top