Robocopy backup with retention options

Pete used Ask the Experts™
Hello, I want to use robocopy to backup a windows 7 C: drive folder to a server share.

I want to avoid a single copy of the backup in case the source gets deleted and it backs up an empty folder. Therefore I need some kind of retention to be able to go back in time. Can Robocopy do this?

Any other ideas for this scenario? 50 windows 7 machines to deploy solution to so needs to be scalable and remote managed.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
NVITEnd-user support
Just don't use the /mir, or /purge options
To avoid a single copy, you need to use a different destination each time. e.g.

robocopy /e /r:0 /w:0 /dcopy:t "C:\source" "C:\target1"

Open in new window

robocopy /e /r:0 /w:0 /dcopy:t "C:\source" "C:\target2"

Open in new window

As an additional precaution on getting good and historical backups of those files using robocopy make sure to enable previous versions on the server and allocate it lots of disk space.

when I want a similar solution, I typically preface the robocopy command with a command or two manage the multiple folders.  For example extend the following 3 day script to a 7 or 10 or 14 day script by adding the appropriate number for REName commands and updating the RD (remove directory) command.

RD /S/Q C:\target3
REN C:\target2 target3
REN C:\target1 target2
robocopy /e /r:0 /w:0 /dcopy:t "C:\source" "C:\target1"

I do a variation on that to collect backups of normal.dotm (for Microsoft Word) from dozens of users computers.
I assume you are wanting to use the /MIR switch to delete files from that backup that have been legitimately deleted, but you don't want the entire folder cleared if the robocopy command somehow checks an incorrect folder that replaced the folder you are interested in. I've tried doing the same thing with very mixed results using a conditional script to test for the existence and contents of the source folder.  In the end there was always an unexpected situation that stopped the backup from working when it was needed most. The rotating folder structure was the only method I had any long term success with. The downside to is the potential to use up a lot of disk space. Especially if a user drops in a iTunes playlist you weren't expecting.

The conditional command I used (not recommended by the way) would have been something close to this:

IF EXIST C:\Source\*.*  robocopy /mir /r:0 /w:0 /dcopy:t "C:\source" "C:\target1"
robocopy is not the ideal solution to do a time machine type deduplication.  You end up with multiple copies that wastes the advantages of robocopy to only copy changes, unless you just rotate the backup through the multiple copies.  I wouldn't rename each copy and start over, that just wastes time and disk space.  You might do 7 different targets, 1 for each day of the week and schedule a task for each of the 7 copies on the different days.  You still have to do 7 time consuming, full copies at the beginning.  However, subsequent copies after the 7 days will be much quicker.

You should try Hard Link Backup for easier deduplication:  The free version allows a single save target per backup and you have to manually start the backup.  The paid version allows you to schedule your backup.  You can have numerous backups to a single target.  The enterprise version allows for 2 simultaneous backup targets, if you want to back up to 2 separate backup media at the same time.  You can run it from your server to pull the remote files from the workstation.

NTFS has had hardlinks with the mklink command.  You can make 1024 hard links per file, good for 1024 days of backups if done daily, or 512 days of backups, if done twice a day.  HardLink Backup makes use of those built-in hardlinks to deduplicate the file, saving disk space and a lot of time on all subsequent backups.  This is easier than installing and running the rsnapshot port from the linux world, but works similarly.  It is also less error prone than scripting robocopy to do a similar thing.

If you want even easier, you should just use mozy or box, however, those cost more.  Based on the fact that you want to use robocopy, I suspect that you don't want to pay too much which is why I suggested HardLink Backup.  It's not too expensive at 39 euros.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial