Thursday, December 3, 2009

Backup Yourself!

Windows Backup is a half-assed program disguised as an administrator's time-saving tool. I made the blunder of relying on Windows Backup recently, and I must admit that because of the way it is structured and organized, I had gained some confidence that it would come through for me when the chips were down.

I was mistaken, and the backup was useless as a recovery tool. For those fledgling computer geeks out there, yes, there are viruses that can actually defeat your prized Norton Recovery Tool or proprietary System Recovery Disk. All you need to do is visit the wrong place on the Internet, and you can say buh-bye to all your precious registry entries you amassed over months or years of software installation. Or worse yet, to other important files not residing on your C:\ drive.

A side note: for those delusional Apple users out there who are laughing right now and then later swarming around the Apple store at the mall to drool on all the latest electronic bling that Jobs is hawking via Geek Squad clones... yes, you too can suffer from unrecoverable data.

Observe an 8-year-user Apple yes-girl who finally gave in to reality:

http://www.youtube.com/watch?v=0dohuX9Ij38


Okay, enough of that. Let's move on to the purpose of this post: I'm going to demonstrate, for my fellow unfortunate Windows users, how to write your own backup program that leaves Windows Backup flipping on its own impotent bits.

(Linux users also using Windows can skip this tutorial, if they already have knowledge of bash, xterm, konsole, etc.)

TUTORIAL:

First things first: you don't have to be a real programmer to utilize the Windows Command Prompt in XP!

Next, if you view yourself as computer savvy, but you're still using a single partition on your hard drive, then don't bother reading this tutorial - you're only kidding yourself and you need to clock "a few" more hours on the workings of your rig. Just buying the latest computer from Dell, HP or Alienware, and using P2P programs to pirate games or download porn doesn't make you a hacker.

Especially in these days of 500GB and 1.5TB hard drives, to assign the entire drive to C:\ is an error you will live to curse. If for no better reason, create smaller partitions for the sake of Defrag; do you really want to wait until the year 2019 to finish your defragmentation? Nevertheless, the most important purpose served by multiple logical drives is having a "neutral" place to store your important files.

Indeed, the essential precursor to this tutorial is a simple admonition to add multiple partitions as soon as you get your new computer or hard drive. I highly recommend a C:\ drive of no more than 20GB for Windows XP. Then, only *rarely* install new programs on C:\. Choose a different logical drive (or drives) instead for programs you install.

If you're distracted at this point because you're using Windows Vista, and still faithfully defending it because it has those super-duper awesome 3D windows... well, look again at the second paragraph of this tutorial. Vista sucks. The jury isn't out on Windows 7 yet, either; Microsoft needs a good calendar year of unofficial beta-testing on their paying customers, before they can approach a somewhat stable OS (with the ubiquitous service packs, of course). Long live Linux!

Okay, after all that, if I still have your attention, then go to Start > Run, and type in "cmd" (always without the quotes!) and click the OK button.

Do NOT type in "command" - this is an 8-character-filename vestige that won't work for our purposes here.

Once at the prompt, you can navigate to any drive and any folder on your computer. For example, just typing "C:" and hitting the Enter key on your keyboard will move you to the C:\ drive. You will probably notice on trying that out, that all you did was get a repeat line of what you already had in the window. This is because the default folder displayed when the "cmd" window opens is *already on* your C:\ drive.

Okay, I could go into much more depth, but to avoid scaring you away, I'd rather just show you the simple backup "batch file" I created for myself, with explanations along the way. The beauty of this is you never even have to open up the command prompt if you've written the batch file correctly.

A batch file is a simple text file (created with Notepad, not Wordpad or Word!), where you eventually rename the file as backup.bat instead of backup.txt. The other two programs include binary formatting that will render your batch file unusable.

This batch file assumes the user name "freddie."

Each new line of a batch file is a separate command. The whole point of making one of these is to automate the copying of your irreplaceable files on the C:\ drive. That way, if a virus hoses your operating system, or you just want to start over with a fresh format of C:\, you've got all your created files saved to a neutral place for retrieval. Things like MSOffice files, mail folders, wallpapers, game saves and settings, etc.

Download the following text file, which is a copy of the batch file I actually use (including a few filename and drive adjustments to protect my computer's security without corrupting the functional potential of the file). Scan it with your Anti-Virus program for your peace of mind (I encourage that for *any* file you download from the Internet!).

backup.txt

I've renamed it backup.txt, so that when you double-click to open it, it doesn't actually run. Just remember to rename your own batch file "backup.bat" before you run it. There is another way to view a batch file without changing the extension (by right-clicking), but I'm trying to keep this simple for batch file initiates.

After you download it, open it and I will explain what's going on, so that you can alter it for your own use, or make your own from scratch. It's super easy, I promise!

Each new line is a new command, so the batch file runs each command in sequential order, from top to bottom. Examine the file closely, and don't take anything for granted (such as placement of spaces).

The first line "c:" (remember, *NO* quotes!) is to change the prompt to the C:\ drive, in case you're running it from a different logical drive (something I highly recommend!).

The next line "cd\" moves the prompt to the lowest folder of the drive (called the "root"). You need to do this to guarantee that your navigation is not situation-dependent.

Next, you'll see "cd WINDOWS" - this makes the prompt enter the C:\Windows folder, where your operating system resides. In this case, I have wallpapers (.bmp) and an Office file (powerpoint.ini) that I wish to backup.

The next line is more interesting. You're actually doing some copying. Always remember that when you execute a command that affects files or folders, you must place a space between the command and the files, as well as spaces between file types and switches. Switches are those letters at the end that have a slash next to them; they are special instructions regarding how to handle the files.

You can learn more about these switches by going to the command prompt and typing the function "help" then a space, then the name of the function. For example: "help xcopy" will display all the switches associated with xcopy, as well as an explanation of what it does. (If you'd like to view all the available commands for the Windows command prompt, just type "help" in the command window and hit Enter).

The other command you'll see used in the batch file is "cd.." - that's two periods! The function of this command is to move down one folder. What does that mean? The closer you get to the root, the further "down" you go. Example:

If your batch file is at the following folder:

C:\Documents and Settings\freddie\Desktop

And the next command is "cd.." then you will now find yourself at:

C:\Documents and Settings\freddie

Get it? "cd\" goes all the way to the root no matter where you are, but "cd.." only goes to the next folder "down."

One last thing, so the batch file makes sense to you:

"*.*" is a way to tell the command prompt that you're referring to all the files in the folder. Therefore, "*.bmp" refers to all files that have the extension ".bmp" (these are bitmaps, a format for pictures, which are what most of your wallpapers are). When accessing a single file, always remember to include the extension (as in "powerpoint.ini").

Now, after you've studied the batch file and understand the concept, then all you have to do is use Windows Explorer to seek out all the folders where your vital, irreplaceable files reside. Navigate the batch file to these folders, and copy the files you want to copy to the drive and folder(s) of your choosing. In this example my backed-up files get copied to the E:\ drive, to the folders named in the batch file.

That's it! When you're ready to backup, simply double-click on your "backup.bat" file.

Now, here's the $64,000 question:

How is it that a simple text file can be more specific (less wasteful), faster, more robust and more user-friendly than the official backup program that's included with Windows?

No comments:

Post a Comment