Friday, February 1, 2008

The Copy Caper

Now why, you ask, would you ever find yourself in a position to copy a very large amount of files from one place to another? Good question. Let's think about this one for a minute {insert Jeopardy theme here}. Ding. Time's up.

Ever thought of buying a new computer? What about all of those files on your current system that you want to keep? Where did you put all of them? Wow, it could take hours and hours to track those bad boys down. If you are anal-retentive and always organized your files neatly, this won't apply to you (maybe). For the majority of us, though, it's a bitch. (This reason is just one example. There are many others that could be explored.)

There is a fairly easy and comforting solution to this. Go spend $90 at your local discount computer hardware store and pick up an external USB hard drive. Make sure the capacity meets or exceeds what you have on your computer. Now, dump every last file on the hard drive in your computer onto the external. When you get the new computer, you can pick and choose what you put back, always knowing that external is there with all your files in case you remember something you needed.

While I realize this is a shotgun or meat ax approach, it sure saves a lot of time and anxiety. Frankly, disk space is cheap these days, and if you really want to go back and clean all the unnecessary files off the external drive and use that space for, oh I don't know, all those extra porn vids you have, that's peachy. But this gives you all the time you want to take to get it done. On the other hand, you are just slobbering over that new PC you just bought, and really want to put it through it's paces, so this is probably going to be the surest way of making sure you don't miss something important before tossing the old machine in the garbage; or better yet, donating it to a worthy cause.

Herein lies another one of Windows most annoying "features". One of the most frustrating elements of copying any more than one or two files from one place to the other within Windows is when there is a file lock on one of those files. A file lock occurs when another application or the operating system itself is currently using a file, and will not allow you to copy, delete, or move said file. If you select a block of files and Windows hits one that has a file lock on it, an error message comes up saying that it could not copy/delete/move the file, and the only option is to click "OK". At that point the process you were going through simply stops. No way around it. That's it. That's all. You then have to deselect that particular file (which is simple; just hold down the CTRL key and left-click on the file and it will leave all the other files selected while the locked file is unselected) and then attempt the process again. If another file is encountered that is locked, wash/rinse/repeat. Are we having fun yet?

Why didn't the big brains at M$ come up with a way to continue without having to go through all of this? How difficult, really, would it have been to put in an option to "ignore file and continue". They provide this option when overwriting files that already exist with files of the same name. Come on M$, pull your head out of your... uh, well, you get the picture.

Ahhhhh... God Bless the command prompt. It once again comes to the rescue. There are a few options when it comes to this process, but let's stick with "xcopy" for now. This is, in my opinion, the best and easiest way to go. I will only point out the basics here. If you want to get into some of the more involved options, type "xopy /?" from the command prompt and it will spit out all of the switches you can use.

Once again, open the command prompt by clicking "Start > Run" and typing "cmd" in the "Open" field, then clicking "OK". Now, let's say we have plugged in our external drive and we want to copy everything from the system hard drive. We will assume there is only one partition and one drive. If a system has more than one drive or partition, simply repeat the process for the appropriate drive/partition. As this example assumes a single drive with one partition, our external drive will most likely be assigned a drive letter of "E:\". If you open up "My Computer" and look at the drive letters, the new external drive will typically have a "type" of external. You may have to format the drive, which can be done by right-clicking on it and selecting the "Format" option. Leave the defaults, except for maybe the volume label. This is just a text label to help describe the drive.

It is my personal preference to create a new directory on the external drive that describes where the data came from. This is even more important when the system drive has multiple drives or partitions. I would use a descriptor like:

\OldSystem_Cdrive

We can create the new directory in Windows or do it from the command prompt. In order to create it from the command prompt, change first to the external drive by typing in "E:" and pressing Enter. Make sure the cursor is blinking next to "E:\>", type in the following command, and press Enter:

md OldSystem_Cdrive

As I discussed in my last post, case will not make a difference here. Windows will "display" the case you specify, but it is not necessary to use the same case every time you type the folder name.

Now, change to the newly created directory by typing the following and pressing Enter:

cd OldSystem_Cdrive

And for our final trick, we will now use xcopy to suck everything from the computers C:\ drive into our new folder (ok, so it really isn't sucking as much as it is mirroring, but I happen to like the word "suck", so like it or lump it). Type in the following command and press Enter:

xcopy c:\*.* /s /e /v /c

The magic in this one is the /c option. This tells xcopy to continue even if an error occurs. This just seems to be beyond the Windows user interface. Ok, now my bitching has turned to whining. I'll stop. Needless to say, this means the process will not only possibly, but likely skip some files. The good news is, the files it will skip are going to be operating system files that you really wouldn't need anyway. As long as you do not have any other applications open whilst running the xcopy, it is extremely unlikely that anything that might be important to you will be skipped (about one one-hundredth of one percent of a chance... but that's just a pull-it-out-of-my-ass guess - seriously, though, the chances are really too small to calculate).

Anyhow, the /s option is the now familiar "this directory and all sub-directories", the /e option (which is a little redundant, but I prefer to include it anyway) says to include even the empty directories and sub-directories, and the /v option says to verify the file after it is copied. The last one simply takes a look at the original, then looks at the new copy, and makes sure they are exactly the same.

That's all for today. There is much more about the command prompt that I intend to discuss, but I will move into some areas that more resembles real Windows topics next time around. My plan is to provide a few tips and tricks to help make things run a little faster.

p.s. Please do not look for posts here every day. It just worked out that way this time, but I doubt I will be able to be that fanatical about it. Also, I know I promised pretty pictures this time, but I did not have my portable drive near me to take said pictures with. I will try to get this post edited in a day or two and add those in.

I hope your day is filled with sunshine and grace!

No comments:

About Me

5'9", dirty blond hair that's going gray, workaholic, lazy bum. Well, that last part mostly has to do with housework. I hate cleaning the house. I'm a bit of an introvert, though I do have my extroverted moments and can force myself to be such if the situation requires it. Been divorced twice, have four children (all girls), and not much of a life. I keep swearing to myself I'm going to get one of those. Oh, did I mention I'm a horrible procrastinator?