August 21, 2005
Xcopy

Last night I got one of those phone calls that computer saavy people hate to get. "Honey, I think my computer is broken. Your father is looking at it, but it says something about reformatting a hard drive."

Yes, my mother's hard drive was failing. They got me the computer and this morning I took a look. Sure enough, the drive wouldn't boot or allow itself to be repaired.

I popped it into my computer to look at it and even then I had trouble getting it recognized. When I finally got it mounted I realized it was in sad shape.

The problem was that some of the files were corrupted and others were fine. I was trying to copy files off of the bad hard drive onto a good hard drive. The problem is that with the drag and drop copy feature in XP, if any of the files you requested copied are bad, the whole copy crashes.

This really bummed me out since I was getting very little copying done due to the bad files. I remembered about Xcopy and figured out a way to copy all the files I needed easily.


How to copy directories with bad files and get the good files

Xcopy is used from the command line, so you need to open a command window. Use Run from the Start menu and type 'cmd', this should bring up a command line interface. That xcopy link takes you to the full manual on xcopy where you can see all the parameters possible.

Xcopy is pretty straightforward, xcopy sourcedir destinationdir is the normal command. But since you know you are copying possibly bad files you need to set a few parameters. The /c parameter tells xcopy to ignore errors. This is key.

So if you want to copy the files out of a bad My Documents directory to a new drive, you'd do something like this.

xcopy "D:\Documents and Settings\User\My Documents" "C:\Saveddata\" -c -s -h -i

This example supposes that the bad drive you are salvaging is the D: drive and the drive you are saving to is C:. You can use tab to autocomplete path names to make sure the path is correct.

Remember, if your directory name or any part of the path has a space in it, you need quotes ( " ) around the path. If you don't use quotes you will get an invalid parameter error. You will probably want to save several different directories, depending on where the data is located, so you can open multiple command line windows and run the xcopies simultaneously if you want to not sit and watch.

When xcopy hits a bad file, don't be suprised if it hangs on the bad file for a minute or two before moving on. Have faith. The xcopy will ignore the errors, because you commanded it to ignore them.

If this isn't clear to you and there are things you don't understand about what I wrote above, you probably shouldn't be trying to save the drive data yourself. Honestly, if you aren't command line saavy, you run the risk of seriously fucking up your computer with xcopy. Call your best geek pal and offer him or her a six pack to come save your data from /dev/null.

Back to my own experience, I was able to save most of Mom's files, the only real blow was a corrupted Outlook pst file meaning that some of her email was gone. I picked a new drive at Best Buy and in a few hours, the computer was up and purring with a sparkling new version of her beloved AOL 9.0 running. The OS patching, anti-virus, and anti-spyware are all set to auto-update. Let's hope for the best.

Posted by michael at August 21, 2005 10:00 PM