.gobump img{ border: 5px solid #ccc; float: left; margin: 15px; -webkit-transition: margin 0.5s ease-out; -moz-transition: margin 0.5s ease-out; -o-transition: margin 0.5s ease-out; border-radius: 5px 5px 5px 5px; } .gobump img:hover { margin-top: 2px; }

twitter

Friday, March 13, 2009

Automate the Backup of Files on Your Hard Drive under Windows XP


If you have a home computer, you likely have important files that you cannot afford to lose. Files can be lost due to a hard drive crash, severe Windows malfunction, virus infection, computer loss or theft, or other causes. Many people do not think about backing up their files until it is too late, perhaps because they are not sure how to do it or do not remember to do it. This article will show you how to methodically back up your important files in a fast, automated, and organized fashion using functionality built into Windows.

Download the free Windows Server 2003 Resource Kit Tools from Microsoft using the "Download RKTOOLS.EXE" link below in the Resources section. Save the file to your Windows Desktop. The Resource Kit includes the ROBOCOPY.EXE program that you will need.

Step2
Install the Windows Server 2003 Resource Kit Tools on your computer by double-clicking the RKTOOLS.EXE file on your Windows Desktop. The installation will automatically place the ROBOCOPY.EXE file (as well as others you do not need) onto your C drive.

Step3
Purchase a USB thumb drive or external hard drive. Thumb drives are currently available in sizes up to 64GB. Unless you have a massive number of critical files, using a thumb drive may be more convenient than an external hard drive.

Step4
Carefully examine your hard drive for any important or irreplaceable files. If any files are not located within your My Documents folder, move them to that location. It is always a good idea to keep all of your files in one central location on your computer, preferably your My Documents folder. If you have some important files on your Windows Desktop, you can leave them there -- we will be backing up your Windows Desktop as well as your My Documents folder.

Step5
Plug your external hard drive or USB thumb drive into your computer.

Step6
Double-click on the My Computer icon on your Windows Desktop and note the drive letter assigned by Windows to your external hard drive or USB thumb drive. For the purpose of this article, we will assume it is drive letter "E".

Step7
Open a Windows Command Prompt by clicking Start - Run, typing CMD , and pressing Enter.

Step8
In the command prompt window, type: MD C:\LOGS and press Enter
This creates a directory which will store the log files generated when you run the backup process.

Step9
In the command prompt window, type: SET USERNAME and press Enter.

This tells you the username you are using on your computer, which in part determines where on your hard drive your files are stored. Make note of the response, which is in the format USERNAME=[user] where the text that appears on your screen in the place of [user] is your username.

Step10
In the command prompt window, type EXIT to close the command window.

Step11
Check the location of your My Documents folder on your computer by right-clicking the My Documents icon on your Desktop and clicking Properties. Look at and make note of the path in the "Target folder location" text box. Click OK to close the Properties dialog box.

Step12
Open Windows Notepad by clicking Start - All Programs - Accessories - Notepad, OR by clicking Start - Run, typing NOTEPAD , and pressing Enter.

Step13
Copy and paste the following five lines, in order, into the Notepad window. This is the actual program (called a batch file) which you will be run to perform the backup.

Copy and paste everything below the dashes
------------------------------------------
Step14
@echo off

Step15
echo Backing up data . . . .

Step16
del /s /f /q "C:\Documents and Settings\[USERNAME]\Local Settings\Temp"

Step17
robocopy "[PATH_TO_MY_DOCUMENTS_FOLDER]" "E:\backup\My Documents" /fp /tee /mir /np /r:1 /w:1 /log+:c:\logs\robo_MY_DOCUMENTS.txt

Step18
robocopy "c:\documents and settings\[USERNAME]" "E:\backup\documents and settings\[USER]" /fp /tee /mir /np /r:1 /w:1 /log+:c:\logs\robo_USER_PROFILE.txt

Step19
-------------------------------------------
Copy and paste everything above the dashes.

Step20
In line 3 (del /s /f /q "C:\Documents and Settings\[USERNAME]\Local Settings\Temp"), replace [USERNAME] with your actual username from step 9. Be sure to erase the brackets, but not the quotation marks.

Step21
In line 4 (which begins: robocopy "[PATH_TO_MY_DOCUMENTS_FOLDER]" "E:\backup\My Documents"):
-- replace [PATH_TO_MY_DOCUMENTS_FOLDER] with the actual path to your My Documents folder from step 11. Be sure to erase the brackets, but not the quotation marks.
-- if the drive letter of your external hard drive or thumb drive is something other than "E", replace the "E" with the correct letter.

Step22
In line 5 (which begins: robocopy "c:\documents and settings\[USERNAME]"):
-- replace both occurrences of [USERNAME] with your actual username from step 9
-- if the drive letter of your external hard drive or thumb drive is something other than "E", replace the "E" with the correct letter.

Step23
In the Notepad window, click File - Save As. Save the file to your Desktop, and name it BACKUP.CMD

Step24
Exit out of Windows Notepad.

Step25
To run your backup, simply ensure your external hard drive or USB thumb drive is plugged into your computer, and double-click the BACKUP.CMD file on your Windows Desktop.

Step26
If you would like the backup to run automatically at a pre-determined interval (e.g., every day at midnight), follow the steps in the Microsoft Knowledge Base article linked below which relates to Scheduled Tasks.

Step27
If you ever need to recover a file from your backup (for example, a file which you inadvertently deleted or saved unwanted edits to), use Windows Explorer to locate the file on your backup drive (in the E:\backup folder), and drag-and-drop it back into its original location on your C drive.

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 

Categories