Looking for an alternative to the Windows 7 Backup and Restore utility? Me too. Backup and Restore is nice but limited. There’s no way to do incremental backups (add only new or changed files to the backup) and no matter what I try the backup just grows and grows and grows with my 220gig profile backup currently at 765gigs. Why? What’s in there?! With four computers to backup in my Family it was looking like a I was going to need IBM for some storage consulting. Back to an old friend, RoboCopy the Robust File Copy utility that comes with Windows. I had last written about my failure to get RoboCopy working with Windows 7 using the automated tool RichCopy. Back to the drawing board! Lots of good data available now with Windows 7 out for 3 years. The results are below – give it a whirl and post any suggestions or issues!
What to backup?
You can backup your entire User Profile with the line of code below saved as a .BAT or .CMD file (batch files) or for more control see the code, steps and downloadable sample below.
robocopy C:\Users\UserName D:\BACKUP\UserName /e /mir /log:UserName-profile.log /xa:sh /xjd
How to run
- Close programs that you’re backing up so in use files are copied.
- Run Manually – by double clicking the file. For some commands or permissions you may need to execute as administrator: Right Click and select Run As Administrator.
- Schedule it – Use Task Scheduler to automatically run your backup daily, weekly or any any time of your choosing see this link
- I schedule my backups for twice a week. Wake the system up and run at 2am. Make sure your destination for the backup is not busy with other possibly conflicting tasks – for example I backup four systems in my house to one drive and schedule them all at different times.
- How to Schedule a Task: http://windows.microsoft.com/en-US/windows7/Schedule…
- Make sure to follow these steps:
- In General tab, check Run with highest privileges.
- In Actions tab, click on the action and then the “edit” button at the bottom.
- In the “Edit Action” Window there is a field for “start in (optional)”, please set the path for your bat file.
Download the Windows 7 Backup Script
Fully functional script – just change UserName to your Profile name and change/remove items to your needs.
Password = backup
Code from the download file
:: Admit it you're here because you used Windows Backup and Restore and were all like WTF!?
:: 09/2012 v1.0 - Graham Fisk
:: ROBOCOPY Resources for the examples below
:: Schedule this beast! - http://windows.microsoft.com/en-US/windows7/Schedule-a-task
:: Commands used in this example
:: /e Copies all directories, subdirectories and empty directories
:: /mir Mirrors the source to the destination
:: /mir WARNING - deletes files on the Desitination that don't exist in the Source
:: /mir Good to maintain a 1-1 backup and keep backup size in control (imagine cache files) bad for keeping everything ever.
:: /xa:sh Excludes hidden system files
:: /xjd Excludes System Junction Points http://tinyurl.com/9n6yumu (MSDN)
:: /xd With file paths excludes the directory and it's contents
:: /tee Writes status output to the Command window for status and seeing errors & file locks. May impact speed and performance
:: /r = Retry, /w = time to wait between retries in seconds - this is for files that are in use
:: CHANGE the script below!
:: UserName to your Windows 7 Profile Name (C:\Users\Fred, Tanya, Chuck Norris...)
:: Destination from D:\backup to your preffered location
:: Exclusions ( /xd ) to match your desired exclusions
:: Mirror profile with Exceptions --!! MIR deletes files in the destination that do not exist in the source !!--
robocopy C:\Users\UserName D:\BACKUP\UserName\Profile /mir /tee /log:UserName-profile.log /xa:sh /xjd /xd "C:\Users\UserName\.explorer.cache" "C:\Users\UserName\.explorer.local" C:\Users\UserName\AppData C:\Users\UserName\Downloads C:\Users\UserName\Links C:\Users\UserName\Searches /r:2 /w:2
:: Now lets grab Email and Browser Profile data (Bookmarks, passwords etc) that were excluded with /xd of AppData above
robocopy C:\Users\UserName\AppData\Roaming\Postbox\Profiles\ D:\BACKUP\UserName\Postbox /mir /tee /log:UserName-data.log /r:5 /w:5
robocopy "C:\Users\UserName\AppData\Local\Google\Chrome\User Data\Default" D:\BACKUP\UserName\Chrome /mir /tee /log+:UserName-data.log /xd "C:\Users\UserName\AppData\Local\Google\Chrome\User Data\Default\Cache" /r:2 /w:2
robocopy C:\Users\UserName\AppData\Roaming\Mozilla\Firefox\Profiles D:\BACKUP\UserName\Firefox /mir /tee /log+:UserName-data.log /r:2 /w:2
robocopy C:\Users\UserName\AppData\Roaming\FileZilla D:\BACKUP\UserName\FileZilla /mir /tee /log+:UserName-data.log /r:2 /w:2
:: Copy all data from Inetpub - does not delete files in destination (use /mir to mirror and delete).
robocopy C:\inetpub\wwwroot D:\BACKUP\UserName\wwwroot /e /tee /log:UserName-www.log /r:1 /w:1
:: Copy all data from Apache - does not delete files in destination (use /mir to mirror and delete).
robocopy C:\wamp\www D:\BACKUP\UserName\wamp /e /tee /log:UserName-wamp.log /r:1 /w:1