There are lots of commercial data back up solutions available in the market. If you are a home user or a small business user of Windows OS and want to backup all your important data then this article shows you a simple incremental backup solution with no additional cost. If you can’t afford to buy a commercial backup application don’t worry! You can still backup your data using Windows xcopy command.
Windows incremental backup
If you already understand what incremental backup is and it’s advantages, you can skip this and move on to next section that explains the syntax.
You can use a USB drive or an external hard disk as the backup location. Copying files to another partition on the same is okay but it may not serve the purpose as a disk crash will cause data loss on all the partitions of that disk. Let’s say your data is in the folder D:\Data and you need to backup your data to Z:\Backup folder (Z: is mapped to some external disk storage device). We can just copy data from D:\Data to Z:\Backup directly using any copy command or tool but it will involve copying the files even though they are not modified from the time they were copied previously. I will explain this in detail. Let’s say you take data back up every week. The first time you back up the data you need to copy all the files in your disk to the backup location. In the second week, you need to copy only the files that have been changed during the last 7 days. You do not need to copy the files that have not been touched since the time you took the last back up. This will save time and also decreases CPU usage and will also lead to increased lifetime for the storage devices. So a backup utility should be able to detect which files are modified and which are not. This is called incremental back up.
Using Xcopy command for incremental backup on Windows
Now let’s see how we can do this using Windows Xcopy command. Xcopy has different switches using which control what files to be copied. We will use these switches to make Xcopy work as a backup utility.
You can run the below command to back up data.
xcopy source destination /M /E /G /H /Y
This one uses archive attributes of files to distinguish the files that have not been changed since the time last back up was taken. /M switch turns off the archive attribute on the files after copying the file to the destination. This attribute will be set only if someone modifies the files after wards. For the above example the command is given below.
Xcopy D:\Data Z:\Backup /M /E /G /H /Y
Back up data using date and time stamps
We can do incremental backup by specifying the date the last back up was taken. Xcopy will copy only the files that have changed after this date. For this we need to run the below command.
xcopy source destination /E /G /H /Y /D:mm-dd-yy
Hope this post has helped you. Let me know your comments on this.