Is it possible to mirror the two directories without overwritting the files in destination directory with new/changed/deleted files. Something like snapshots.
Example:
Copy the source directory with all files and sub-directories to destination directory, but if destination directory contains, for example, file A.xls
and A.xls
has been changed in source directory then copy A.xls
but keep the previous A
in destination directory as well. To preserve the previous file a datestamp, or counter can be added to the file name.
Example after copy:
SomeDirectory
|–A.xls
|–A_20120701.xls
|–A_20120920.xls
Thank you.
Best Answer
No, this isn't possible using Robocopy. Mirroring a folder path using Robocopy will delete files in the destination if they no longer exist in the source. You can ensure that you don't overwrite files with older versions but you can't retain older versions / rename during the copy process.
I wrote a command script / batch file that copies modified files, but creates the tree structure based on the date that the script is run
e.g. my tree for one particular file would be.
I could post a sample of that script if you might find that useful.
Due to popular demand, please find below my basic backup script.
if you have any questions about this script (I cribbed it quickly from my main backup script, and didn't test it thoroughly) then email me at my gmail account with the subject line 'Server Fault Backup Script query'. If you can work out my gmail address without asking then I'll be happy to help you.