Simple file backup from command prompt. (windows)


If you want a file to be backed up in different versions you can utilize the built in task scheduler and a simple .bat file. By creating a backup.bat file containing the file you want to save and a destination.

xcopy "C:\files\Data\Data.csv" "C:\Backup\%DATE% %time:~0,2%-%time:~3,2%-%time:~5,2%\" /V /I /S

which will end up with a destination folder at C:\Backup\21-08-2014 12-41-23\CsvData.csv

%DATE% gives you the current date
%time:~0,2% gives you the hours
%time:~3,2% gives you the minutes
%time:~5,2% gives you the seconds
Because %time% outputs 12:41:23 format which is an illegal character for folder name, the 0,2 means index 0 and then 2 characters. index 3 and two characters, and so on.

This line will copy the data into a new folder date and timestamped so it wont overwrite previous ones. Then you can create a scheduled task to run at what interval you'd like.