Backup Script

A Simple problem of keeping a backup, solved in a rather simple way. (for windows machines)

Create a text file called ‘Backup’ and change it’s extension to .bat. Right click > Edit, then paste in the following code.

xcopy C:\Hornresp\* E:\Backup\%date:~6,4%-%date:~3,2%-%date:~0,2%\Hornresp\* /Y /Q /S

Run the script and it’ll copy everything from the first folder into the second folder (that it will create with the following date structure). SIMPLE. Just change the folders to suit your own needs.

backup\YYYY-MM-DD\folder.

Fancy doing an incremental backup? No problem; simply amend the code with the following

xcopy C:\Hornresp\* E:\Backup\%date:~6,4%-%date:~3,2%-%date:~0,2%\Hornresp\* /Y /Q /S /D:05-01-2013

(above for the first of may 2013) This will copy every file changes since the date added to the end. It uses the NTFS modified date so it possible any other backup software modifying NTFS archive bits may amend the date modified too (but it shouldn’t).

Anyway – got more than one folder to backup – just add more lines and change the folders to suit.