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 is for you. If you can’t afford to buy a commercial backup application don’t worry! You can still backup your data with a simple windows command called Xcopy.
You can use a USB drive or an external hard disk as the backup location. Copying files to another partition on the same disk will 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 changed. 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 lot of time and also decreases CPU usage and also will lead to increased lifetime for the storage devices. So a backup utility should be able to detect which files are changed and which are not. This is called incremental back up.
Now let’s see how we can do this using Windows built-in Xcopy command. Xcopy has different switches using which we can specify the conditions on what files need 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.
Xcopy command syntax and examples