0

I have a set of 24 files with 24 different extensions that I want to copy to a backup directory and append the date in the filename if they are different from the previous version of the file. I made the following BAT file and run it daily (there are 24 lines in the BAT file, one for each extension):

copy CNP.ang bakup-do-not-erase\CNP_%date:~4,2%-%date:~7,2%-%date:~10,4%.ang

Using the above BAT file I get a copy of the data file (all text) every day. I would like to add a little more intelligence to the copy and only do the copy if the file has changed since the last time I made a copy of that file. I suppose that I could always do the copy to the backup directory and then make a second pass with a new BAT file and delete the newer file if it were the same as the previous days version.

What I want to accomplish is to safeguard the data in case someone deletes some lines and be able to restore the previous data file but I don't want to have 30 copies of the same data if it has not changed.

1
  • 2
    look into Robocopy or similar tools. It should suit your needs perfectly. You can even monitor the folder permanently for changes. Jul 9, 2013 at 13:17

1 Answer 1

1

You could use XCopy with the /D: parameter (If you don't put a date after the colon, then it'll only copy files newer than what's in the destination directory).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .