How to Do Robocopy Incremental Backup [Switch & Example]  

How to Do Robocopy Incremental Backup [Switch & Example]


Table of Contents
  1. Can You Use Robocopy to Do Incremental Backup/Copy?
  2. How to Create Robocopy Incremental Backup
    1. More copy options to optimize your Robocopy incremental backup script
  3. How to Do Scheduled Incremental Backup with Recovery Option
    1. Related information about backup and sync
  4. Conclusion

Can You Use Robocopy to Do Incremental Backup/Copy?

Robocopy (Robust File Copy) is a command-line for file replication since Windows Vista and Windows Server 2008. It functionally replaces Xcopy with more options, like mirroring, monitoring, retry when error occurs, etc.

Many users may wonder: is Robocopy incremental? Robocopy creates an intact copy at the first time, and sync only changed files to the target directory from the 2nd time. So yes, you can use Robocopy for incremental backup.

With some parameters or the help of Windows Task Scheduler, you could even perform Robocopy incremental copy automatically with a schedule.

Incremental Backup

⚠️Drawbacks of Robocopy:
  • It cannot copy open files or live operating system volume;
  • The operation is not intuitive enough for users who are used to GUI software;
  • Most of all, Robocopy won’t keep different versions of the source data nor provide image recovery.

That is to say, if you accidentally delete or modify something and run the backup unknowingly, these mistakes will be synchronized to the target directory, and you cannot retrieve any of the older copies.

If you don’t mind about it, keep reading and follow the steps to do incremental backup with Robocopy. Otherwise you could also use an incremental backup tool with recovery options to avoid this situation.

How to Create Robocopy Incremental Backup

You can use Robocopy to perform incremental copy automatically.

To explain it clearly, I’ll give an example to backup files from C:\test to D:\test.

Step 1. Open CMD

Press the Win+R key to open the “Run” window. Enter “CMD” and hit OK.

Step 2. Input the command for incremental copy

The basic command of robocopy is: robocopy [source] [destination]

The files in source folder will be copied to the destination folder.

Here's an example:

robocopy C:\test D:\test

Check the target directory, you’ll find the files have been backed up successfully. If you add or modify files in source directory later and run Robocopy again, the changed and newly added files will be synchronized to the destination.

Robocopy Basic

Step 3. Add useful switches to customize the backup

You could enrich your Robocopy incremental backup script with practical switches.

*If you want to copy all the changes & deletions in the source directory as well, add /mir after the command. It also backs up all the subdirectories even empty folders.

*You could also use /xo to exclude older files. During copying the source directory, it will skip the files that already have the same or newer copies in destination directory. For example, if you first modify a file in folder A, and then the same file in folder B, the default incremental backup will copy A to overwrite B, while the /xo mode will skip the change because the file in folder B is newer.

*You can use other parameters, like /s (include subdirectories), /z (copy files in restartable mode), /np (don't display percentage of copied files) and so on. You could combine Robocopy incremental backup with switches you need.

For example, the command could be like:

robocopy C:\test D:\test /s /xo /z /np

Step 4. Automate the incremental copy with Robocopy

To create an incremental backup task using Robocopy on regular basis, you can either add parameters or use Windows Task Scheduler.

👉By parameters:

/MON:n will monitor the source directory and execute incremental backup when "n" or more changes are detected.

/MOT:m will execute another incremental backup if changes are detected in "m" minutes'.

/RH:hhmm-hhmm makes Robocopy to copy files between "hhmm" and "hhmm", e.g. “/RH:1700-1800”.

In my case, I use the command below to back up changed files every 10 minutes.

robocopy C:\test D:\test /mot:10

This way, you can use Robocopy to incremental copy files at the frequency you set.

Robocopy Mot

*If you want to terminate the task, you could open another CMD window and enter “taskkill /f /im robocopy.exe”.

👉By Windows Task Scheduler:

You can also create an incremental batch file with Robocopy, and then use Task Scheduler to automate it.

Open notepad, input the Robocopy backup script you want to implement. Here I want to incremental copy all the subdirectories, so add the parameter /s as well.

Click File > Save As. Then give it a name you like, Robocopy incremental backup, for example. Change the extension from .txt to .bat. and click Save.

Robocopy Bat

Search for Task Scheduler in Windows or in Control Pane. Open it, choose to Create Basic Task.

Task Scheduler

Enter the task name and description, then choose when or what to trigger the task. Here I choose Daily and specify the time point in the next page.

Choose Schedule

Choose Start a program as the action to perform the task.

Start A Program

Then click Browse to select the Robocopy backup script (the .bat file) you just created.

Browse Program

Confirm the information and click Finish to complete the process. Then you can find the scheduled task in Task Scheduler Library and execute or delete it anytime you like.

More copy options to optimize your Robocopy incremental backup script

If you have further needs, there are some common switches you could use to optimize your Robocopy incremental backup script. Click here to view the full edition of Robocopy syntax.

👉Copy options

/s Copies subdirectories and excludes empty directories.
/e Copies subdirectories and includes empty directories.
/z Copies files in restartable mode.
/b Copies files in Backup mode.
/purge Deletes destination files and directories that no longer exist in the source.
/mir Mirrors a directory tree (equivalent to /e plus /purge).
/mov Moves files, and deletes them from the source after they are copied.
/move Moves files and directories, and deletes them from the source after they are copied.
/mon: Monitors the source, and runs again when more than n changes are detected.
/mot: Monitors the source, and runs again in m minutes, if changes are detected.
/rh:hhmm-hhmm Specifies run times when new copies may be started.

👉File selection options

/a Copies only files for which the Archive attribute is set.
/m Copies only files for which the Archive attribute is set, and resets the Archive attribute.
/xc Excludes changed files.
/xn Excludes newer files.
/xo Excludes older files.
/is Includes the same files.
/it Includes modified files.
/maxage: Specifies the maximum file age (to exclude files older than n days or date).
/minage: Specifies the minimum file age (exclude files newer than n days or date).

👉Others

/r: Specifies the number of retries on failed copies. The default value of n is 1,000,000 (one million retries).
/w: Specifies the wait time between retries, in seconds. The default value of n is 30 (wait time 30 seconds).
/l Specifies that files are to be listed only (and not copied, deleted, or time stamped).
/x Reports all extra files, not just those that are selected.

How to Do Scheduled Incremental Backup with Recovery Option

As stated before, it’s risky to back up important data with Robocopy, because there’s no rollback option for the mistaken changes and deletions that have been copied to target directory. If you want to manage incremental backup more safely and intuitively, backup software like Qiling Disk Master Standard could serve you better.

Compatibility - It’s a backup & sync tool supporting all Windows OS and enables you to do full or incremental backup between various devices (internal/external hard drive, USB, network share, NAS, cloud).

Image Backup - You could set up a scheduled task to run incremental backup automatically. Thus only changed files will be captured and you can easily roll back to any earlier version.

File Sync - In addition to recoverable image backup, you can also copy files with original formats using Sync feature, which is more similar to Robocopy incremental copy but with GUI. Schedule options are also available.

*The free Standard edition could already meet most of incremental backup needs. If you upgrade to higher editions like Professional, there are more advanced features: real-time sync, two-way sync, differential backup, etc.

Now, I’ll introduce the operation to perform incremental backup with the Robocopy alternative. You could download and install the freeware to get started.

Step 1. Launch the tool to get started

Navigate to Backup > File Backup. You could also choose Partition Backup, Disk Backup, System Backup, or Cloud Backup accordingly.

File Backup

Step 2. Specify the source folders or files

Click Folders or Files to select the source data.

Add Folders Files

If want to add files from network locations, click Share/NAS in the popping out window and then Add Share or NAS Devices to specify the path.

Select Network Location

In higher editions, you could also click the funnel icon to include or exclude files with specific extensions.

Step 3. Select the target path that you want to copy files to

Choose backup destination. In addition to local folders or connected removable devices, you could click the small triangle to select network location or cloud drive as you like.

Select A Network Location

Step 4. Schedule the incremental backup task

Click Schedule Backup to create an automatic backup. It’s run in incremental mode by default. Optionally, you could manage more backup Options or set up a Scheme.

Schedule Backup Advanced

Schedule Backup options include Daily/Weekly/Monthly/Event triggers/USB plug in. The last two are available in advanced editions.
Options enables you to manage compression level, image splitting, comments, email notifications, etc.
Backup Scheme helps you to perform the scheduled differential backup and delete older backups automatically according to the rule you set up. Available in advanced editions.

Then, click Proceed to execute the task.

Related information about backup and sync

>> Incremental and differential backup will back up only changed files and therefore save your time and space. But incremental backup is based on the last backup, full or incremental, and incremental backup is based on the last full backup.

When it comes to restoration, incremental requires the last full backup plus all the subsequent incremental backups in order, while incremental needs only the last full backup and the latest differential backup. As a result, incremental backup is faster in backup, and differential backup is faster in recovery.

>> Image backup and sync are both considered as backup in a broad sense. But the former will create a recoverable image file, and the latter will create an exact copy for direct access and use. If you want to save different versions of the source data, image backup in incremental mode is obviously the better choice.

Conclusion

Robocopy performs incremental backup by default to copy only changed or newly added files. You can schedule it by additional parameters or Windows Task Scheduler. However, Robocopy doesn’t have recovery options to retrieve any of the older versions. If you don’t want to mess up the data nor lose some files irreversibly, it may be more reasonable to do incremental backup with specialist software.

As an alternative, Qiling Disk Master could help you set up incremental or even differential backup with schedule. All your copies at different time points will be saved for future recovery. And if you want to do it in Windows Server, don’t worry, there’s also specialized Server edition.

Related Articles


Is this information helpful?     

What can we do to improve this information? (Optional)
Refresh Please enter the verification code!