rem ############################################################################################### rem robocopy_backup.bat rem Robocopy Batch Script - by Peter Falkenberg Brown - January 7, 2012 rem peterbrown@worldcommunity.com - http://significatojournal.com rem Robocopy is Trademarked by Microsoft, and is included with Windows 7 rem in this directory: c:\windows\system32\Robocopy.exe rem ############################################################################################### rem PLEASE READ THE NOTES AT THE BOTTOM OF THIS FILE CAREFULLY, **BEFORE** USE! rem Rename this file with a .bat extension, i.e. 'robocopy_backup.bat'. rem ############################################################################################### echo off cls echo Using Robocopy for Windows 7 echo . echo copying files... rem FIRST RUN COMMAND c:\windows\system32\robocopy C:\Users\USERNAME\Documents d:\BACKUP_DIRECTORY /CREATE /E /V /ETA rem REGULAR RUN COMMAND rem c:\windows\system32\robocopy C:\Users\USERNAME\Documents d:\BACKUP_DIRECTORY /MT /MIR /R:3 /W:3 /V /ETA /TEE echo . echo Done! echo . pause rem ############################################################################################### rem NOTES ARE HERE rem See more documentation about robocopy here: rem http://technet.microsoft.com/en-us/library/cc733145%28WS.10%29.aspx rem "rem" is the DOS "comment" tag: i.e. anything after "rem" is ignored in a batch file. rem PLEASE EDIT THIS BATCH FILE IN A TEXT EDITOR, E.G. NOTEPAD (NOT WORD FOR WINDOWS) rem This batch file must be run as "Administrator". rem Right click the batch file (or its shortcut) and set it to Run as administrator. rem NOTE: EDIT THE SOURCE AND DESTINATION DRIVE LETTERS AND DIRECTORIES, e.g. rem C:\Users\USERNAME\Documents rem d:\BACKUP_DIRECTORY rem We assume that d: is a usb drive (as one example) rem I run this script by placing a shortcut on my desktop, then plugging in my usb drive every night rem and then clicking the shortcut. An updated backup of 30 gigs only takes around 5-10 minutes. Voila! rem YOU MUST EDIT THE "rem" COMMANDS ON THESE TWO LINES: rem ........................................................................... rem NOTE: The first run command above creates empty directories and files rem in order to minimize directory fragmentation. But, it's only run ONCE. rem "Uncomment" (remove the "rem") from the FIRST RUN COMMAND, when you run this for the first time, rem and also add a "rem" in front of the REGULAR RUN COMMAND, during that first run. rem After the first run, put the "rem" back in front of the first run command rem and remove it from the regular run command. rem ........................................................................... rem After running this batch file the SECOND TIME (i.e. after making a full copy of your files), rem the subsequent runs will copy files in "Incremental" and "Mirror" mode. rem That is, the program parameters are set maintain an exact mirror of your source directory, rem which means that when you DELETE a file from your source dir, it will be deleted from your rem TARGET DIRECTORY. rem See more documentation about robocopy here: rem http://technet.microsoft.com/en-us/library/cc733145%28WS.10%29.aspx rem ###############################################################################################