Monday, 27 July 2009

Incremental Backup using BATCH commands

Good old DOS
There is an easy and geek way to make incremental backups in Windows using just the bloc notes and the command-line. There are just a few steps, easy to follow:


Copy this string into a new text file with bloc note or your favourite text editor:

@echo off

xcopy “C:\Folder 1” “D:\Backup Folder 1” /E /H /R /Y /I /D
xcopy “C:\Folder 2” “D:\Backup Folder 2” /E /H /R /Y /I /D
xcopy “C:\Folder 3” “D:\Backup Folder 3” /E /H /R /Y /I /D

pause

Save it with the .bat extension (it can be done in the bloc notes selecting "All Files" as extension and naming the file such as backup.bat).

It's done!


If you run the file just created, a command-line will open and it will make an incremental backup of Folder 1,2 and 3 (the source folders) into Backup Folder 1,2 and 3 respectively (the destination folders).
You can remove or add more folders to make simultaneous backups.

New files in the source folder will be written in the destination folder, existing files will be kept, updated files will be overwritten, deleted files wont be deleted in the destination folder (from this the name "incremental").

No comments:

Post a Comment