Batch file or copy and rename files in different drive/directory

mcquicker

Distinguished
Oct 12, 2010
2
0
18,510
Problem:

I have a batch file that copies files from one source drive/directory to a target drive/directory.

I would like, however, for the batch commands to copy the same files but, instead of replacing in the target drive/directory, to add the files with a number, so I can go back and retrieve changed information from previous files, if necessary. E.g. - I copy textfile.txt, then when I copy the file again, instead of replacing it, it leaves the original file in place, and copies the newer file with a _01 added, etc.

textfile.txt
textfile_01.txt
textfile_02.txt

Many thanks in advance
Peter
 
Although it might be possible to do that with a batch file (if you are well versed in Microsoft scripting language), what you want is implemented by a specialized backup software, where history of files is maintained. On most such apps, you can configure how long the backups are retained, how often they are performed, things like that.

If you still need to use batch files - why not backup to separate folders for each day?