Robocopy

What is Robocopy? No it isn’t anything to do with RoboCop 🙂 Robocopy a.k.a. Robustcopy, is a free application that is built-in to Windows, if it isn’t already installed you can just download it from Microsoft. As the name suggests, it’s a “utility” that lets you copy/backup files on your Windows PC. I’ve used it for many years in conjunction with “bat” files, it does also come as a GUI version which makes it very easy to use.

I prefer to use the “script method” but this isn’t difficult or I wouldn’t do it 🙂 The script is very easy to do, you use notepad to create the backup job and then save it as a “.bat” file (batch file). You can then run this manually whenever or you can use Task Scheduler to run the “.bat” file whenever you choose. A “bat” file is basically a sort of mini program a.k.a. “an Executable” and generally “bat” files are used by IT Geeks, Nurds or Pros but don’t let this put you off 🙂 Most of the time the bat file will consist of one line.

Robocopy works by using “Switches” (basically options) and can be a little unforgiving at times when it comes to the syntax but just Google for Robocopy switches and all will be revealed. Mainly all you need are examples of the switches and/or scripts. Different people have different ideas on how they want their backups to be done. You can get a complete list of all the switches by typing robocopy /? into a command prompt. Robocopy is very powerful and will do what you tell it to. Hopefully what you tell it to is what you want it to do 🙂

I tend to use the MIR (mirror) option as this literally creates a mirror (exact copy) of the folders that you are backing up. The backup will only backup any changes so it does it very quickly.

Here’s a very simple “bat” file that I use for most of my automated backups, simple one line.

robocopy c:\mystuff “\\192.168.0.201\Datastor\MyStuff_Square” /MIR /Z /w:5 /LOG:C:\RoboJeff\backupMYstuff.log

Lets break it down.

robocopy c:\mystuff

The robocopy bit is just invoking/starting robocopy

The c:\mystuff  is just telling Robocopy what you want to backup, this can be a folder or a single file.

The “\\192.168.0.201\Datastor\MyStuff_Square” is telling Robocopy where to put the backup, in this case I’m putting the backup on a network share. I’ve used the IP address of the server (with the network shares) but you can just use the “NETBIOS” server name. Note the speech marks, this allows for the file path to have spaces but I tend to use the underscore instead of a space.

The “switches”

/MIR  creates a mirror image. This means that if you have added or amended a file in the source folder, it will copy it. If you have deleted a file in the source folder, it will delete the file from the backup location.

/Z option is basically a “restart” option, this is useful if you have a large file(s) to backup and it gets interupted, it will restart where it left off.

/W:5 just tells it to wait 5 sec before retrying.

The /LOG:C:\RoboJeff\backupMYstuff.log  just tells Robocopy where to put the log file of what its done.

You can get a full description of all the switches from Technet.

Robocopy in action

Robocopy can be part of your backup strategy or indeed your only backup strategy and it helps if you have “network shares” but a USB Ext drive will also be more than adequate, providing it is connected when you want to run the back up 🙂 1TB Ext USB drives are can be obtained for about £40

All my “main Windows devices” are running Windows 10 and all devices on the LAN run several Robocopy scripts every evening to backup “My Docs”, “Desktop” and even “Thunderbird” (email client). The backups are stored on a CentOS7 file server with SAMBA network shares and work superbly well.

During the night, the CentOS server runs RSYNC scripts (the Linux equivalent of Robocopy) to back up the network shares to an external USB harddrive.

In addition, I create weekly disk images of the Windows devices using Macrium Reflect and I also make use of the Backup facility built-in to Windows (from Win 7 on and that is unbelievably good). It might not be the best backup strategy in the world but it seems to work for me.

Back up Strategy

The most important backup is the one you didn’t do 🙂

Just accept that one day your system drive and/or your data drive, if you have a separate one, will fail or a file will get deleted in error or a file will get corrupted. For disk failures, a disk image will get you back up and running in no time. If the image is missing some of the more recent files, you would get these from the Robocopy files or the Windows backup files.

If you don’t actually have a backup strategy in place, do you feel lucky 🙂