Departments

Home

Blog

Books

Training

Support

Dictionary

Fun


October 24, 2012

Doing a Manual Backup Automatically, Part II

Filed under: Main — admin @ 12:01 am

Assuming that you’ve read Monday’s blog post, you have a thumb drive that can handle a manual copy, or backup, of some important files. This blog post describes the DOS command used to actually copy over those files.

Step 2: Running the manual backup program

Yes, only bold, strong computer users bother with DOS any more. Yet, DOS holds some power that Windows lacks, specifically when copying files. In fact, DOS does it quite effectively, providing you have some patience.

The DOS command I chose for copying/backing up files is robocopy. It’s Microsoft’s third iteration of the basic file-copying command, copy. The second version was xcopy.

I chose the robocopy command because of its /mir switch. That switch effectively duplicates files and folders from one storage device to another. It adds files found on the source but not on the destination. It also removes files found on the destination, but not on the source. The end result is a mirror copy.

Before you use robocopy you need to know two tidbits of information:

• First, you need to know the pathname of the folder you’re backing up.

• Second, you need to know the drive letter for the thumb drive.

You can get the pathname from the folder’s Properties dialog box: Right-click on the folder’s icon and choose the Properties command. The Location text describes the path — but not all of it. In Figure 1, the text is C:\Users\Dan\Documents. The rest of the path includes the Work folder name itself, separated from the rest of the path by a single backslash. So the full pathname is C:\Users\Dan\Documents\Work

Figure 1. A folder’s properties dialog box.

Leave the folder’s Properties window open so that you can later reference the pathname.

To discover which drive letter the thumb drive uses, visit the Computer window: Press Win+E on the keyboard. Hopefully your PC isn’t overly burdened with drive icons, so the thumb drive ketter is easy to spot. Commit that drive letter to memory, or jot it down somewhere.

With your two tidbits of information — the folder’s pathname and the thumb drive’s drive letter — you’re ready to plunge into DOS.

Fire up a command prompt window:

  1. Press the Win+R keyboard shortcut.
  2. Type cmd into the Run dialog box
  3. Click OK.

Now you need to construct the robocopy command. It takes on this format:

robocopy [source] [destination] /mir /r:1

/mir is the mirror switch, which directs robocopy to duplicate, or mirror, the files between the source and destination.

/r:1 is a retry switch. If robocopy errors, it normally retries copying the file 1,000,000 times. I’m not kidding! By setting /r:1, robocopy retries only once before moving on.

Here’s how to deconstruct the robocopy command to perform a backup or mirror of a folder:

  1. At the DOS prompt, type robocopy and a space.
  2. Type the pathname to the folder you want to duplicate. On my PC, I type C:\Users\Dan\Documents\Work
  3. Type another space.
  4. Type the Destination drive letter for the thumb drive, followed by a colon. For example type F: for drive F.
  5. Type \backup. The destination should look like F:\backup. I recommend typing a folder name like backup so that the duplicate files don’t reside in the main, or root, folder on the thumb drive.
  6. Type a space, then /mir
  7. Type another space, then /r:1

Confirm the command. On my computer, the command looks like this:

robocopy c:\Users\Dan\Documents\Work f:\work.bak /mir /r:1

That command duplicates files in my Work folder — and all its subfolders — onto drive F in the work.bak directory.

And now, the big moment: Ensure that the thumb drive is inserted in the USB port, then press the Enter key to run the command.

If all goes well, then you’ll see a quickly scrolling screen, detailing all the files as they’re duplicated.

Close the command prompt window, and all other open windows, after robocopy has displayed its summary.

If there is a problem, check the command line: Press the F3 key. Ensure that you have all the proper slashes pointing in the correct direction. Ensure that you typed in the correct pathname. If the pathname contains spaces, you may need to place them in double quotes, as in:

robocopy "c:\Users\Dan\Documents\Business Letters" f:\work.bak /mir /r:1

Notes

The first backup takes the longest. That’s because all the files must be copied. After that, robocopy duplicates only updated files. It also removes files you’ve deleted on the source. Again, that /mir switch is about mirroring the copies so that both are up-to-date.

While robocopy and the pathname nonsense may seem burdensome, consider that the copy is made — and updated — by using that single robocopy command. There’s no windows to open, no repetitive drag-and-drop operations.

On Friday’s blog post I’ll describe how to use the Task Scheduler to run robocopy for you automatically.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Copyright © 2017 Quantum Particle Bottling Co.
Powered by WordPress