Use Xcopy To Backup Your Data To An External Drive

| March 3, 2013

PCTechBytes has always stressed the importance of backing up your data. Imagine what would happen if you turned on your computer this morning and your computer did not boot up. Is your data backed up to a different drive? Have you just lost everything? While there are numerous backup systems available, the bottom line is you need to have your data backed up to a different drive–preferably to a drive outside of the computer case, such as an external drive or a Network Attached Storage Device (NAS)–preferred.

  • Why a different drive? If the drive mechanically fails that data is gone.
  • Why a drive outside of the computer? If the computer gets stolen, the data is gone.
  • Why is a NAS preferred? A NAS can be a great backup solution for the entire household.

How To Backup Using Xcopy

Xcopy is a utility built right into Windows. You can easily create a batch file that runs on a schedule to backup your computer to a NAS or external USB drive each night. There are many switches you can use to tweak how Xcopy behaves. For this example, we are only going to use two: /E (Copies directories and subdirectories even if empty) and /Y (Suppress prompting to overwrite files). If you want to see the entire list of switches, open a command prompt and type c:> xcopy/?

Next, we’re gong to open notepad and type the following:

xcopy “C:\Users\MyUsername\Desktop\My Taxes” “\\ENTERPRISE\Public\Backups\My Taxes” /E /Y

In this example, I am instructing xcopy to copy a folder from my Desktop called My Taxes. In the next set of quotes I am telling xcopy to copy this folder to a Network Attached Storage device called Enterprise to the folder My Taxes in the Public directory. Note: I have already created an empty folder called My Taxes on the destination drive.

Of course, your target and destination folders will be different.

Next, save the file as a batch file. In this example, we are using backup.bat. Make sure you use the .bat extension.

batch

If you’ve done it correctly, the file shortcut should resemble two meshed gears. Now you can run this manually just by double clicking it. You will see the command prompt open and close quickly. That’s it. The files were just copied from one location to the other. Now your files live in two places. Congrats!

Test the batch file to make sure it is working. If not, check the path to the folders. Usually you can do this by right-clicking the folder and selecting Properties.

Setup Task Schedule To Run Your Batch File

Now that we have a batch file setup to copy our files, we want to setup Task Scheduler to automatically run the batch file. To do this, Navigate to Control Panel\System and Security\Administrative Tools. Next, select Task Scheduler.

xcopy1a

Click Create Basic Task.

xcopy2a

Name it whatever you desire and give it a description.

xcopy3a

Select how often you want that batch file to run. In this example, we chose Daily, but weekly might be fine for you, depending how often your files change.

xcopy5a

Finally, confirm your settings and then click Finish. Congratulations, your batch file is scheduled to run automatically.

In conclusion, many Network Attached Storage devices will come with some type of program to help you backup. Personally, I find these programs to be a little clunky. Try the program provided first to see if it does what you need it to do. If so, great. Otherwise Xcopy is a great and simple solution. If you’re looking for a NAS, I like the WD My Book Live 2TB  version as it offers plenty of space for the entire household.

As a final thought, a external NAS (unless it has multiple bays with multiple drives) should only be considered a backup and intermediate device for sharing files. Make sure you always have at least another copy somewhere else, such as your PC.

Category: Tips

Dave

About the Author ()

Dave has been providing free computer repair and tech support advice online since 2002. Join us on our forums and be sure to subscribe to our newsletter for weekly tips and other helpful computer articles. Connect with me on: Google+

Comments (1)

Trackback URL | Comments RSS Feed

  1. Robocopy may be a better option than xcopy these days. It’s been available since Vista. The ability to copy file and folder names exceeding 256 characters may be important. xcopy can’t do this:

    http://en.wikipedia.org/wiki/Robocopy