2009-02
How-to-document
Data backup on external hard disk using XCOPY
Inhalt
1.
Abstract.................................................................................................................... 3
2.
Introduction ............................................................................................................. 4
2.1 What is this all about .....................................................................................................4 2.2 What will you read in the following chapters......................................................................4 2.3 Language......................................................................................................................4 2.4 Copyleft and suggestions ................................................................................................4 3.
First step: Where are your files? .............................................................................. 5
3.1 Find your default path ....................................................................................................5 3.2 Find your data ...............................................................................................................6 4.
Create myxcopy batch file ........................................................................................ 8
4.1 Open a new file in Editor / Notepad..................................................................................8 4.2 Enter the command text ...............................................................................................11 5.
Run your backup .................................................................................................... 12
5.1 First backup ................................................................................................................12 5.2 Following backups........................................................................................................14 5.3 Deletion of files ...........................................................................................................14 5.4 Edit myxcopy.bat.........................................................................................................14 6.
Additional Information ........................................................................................... 15
6.1 Using Backup programs ................................................................................................15 6.2 XCOPY on the web .......................................................................................................15 6.3 My personal backup file ................................................................................................15 7.
Disclaimer .............................................................................................................. 16
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
2
1.
Abstract
Any kind of data can be lost or damaged. In computer centers, data backups are performed regularly by administrators. Especially for laptops and personal computers, the user himself should take responsibility for data backups. As nowadays external hard disk drives are fairly cheap, it is recommendable to buy an external hard disk and to run backups regularly. The purchase of a hard disk is one part; the execution of the backup is another one. In order to be encouraged to run the backup regularly, the backup procedure should be easy and fast. The strategy to make backups fast is to make full backup first and then run incremental backups which are much faster. The full backup means to copy all files onto the external hard disk. On a normal business computer, this (first) backup can take several hours. The following backups are only incremental backups; this means that only files that are new or have changed since the last backup are copied to the external disk. On an average business computer, a weekly backup consumes normally between five and fifteen minutes. To execute the backups, a lot of good software products are available for purchase and also as freeware. Another possibility to execute regular backups is to use the windows command XCOPY. XCOPY is a command line program which runs on windows in CMD.EXE. People who remember a few things from the ancient MS-DOS times can easily create a batch file for regular backups with one simple line. The line text is: XCOPY "D:\Documents and Settings\MY.USERNAME\My Documents\*" "E:\MYBACKUP\My Documents\" /C/E/H/D/Y MY.USERNAME and the letters of the disks have to be changed to the current values of the individual computer. Then, this batch can be used both full backup and following incremental backups.
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
3
2.
Introduction
2.1
What is this all about
The intention of this document is to show a very short and very simple way to do data backups on a Windows computer without installing any software. If you can still remember a few things from the DOS times, you will find an easy and fast way to backup your data. If you are interested in more sophisticated batch programs for backup, try to search the web with the Keywords “XCOPY BAT”.
2.2
What will you read in the following chapters
In chapter 3 “First step: Where are your files?” you will see how to find the technical names of folders you want to back up. In chapter 4 “Create myxcopy batch file” you will see how to create a batch file for data backup. And in chapter 5 “Run your backup” you will see how to actually execute the full backup and the following incremental backups.
2.3
Language
The hardware on which this document was created was set up in German. Please apologize the German hardcopies.
2.4
Copyleft and suggestions
Please feel free to copy, forward or publish this document, especially if you like it. If you have any suggestions, corrections or improvements, please send an email to:
[email protected]
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
4
3.
First step: Where are your files?
3.1
Find your default path
At first, you need to know where your files are located on the hard disk of your PC or laptop. To do so, you click on Start Next click on Execute (or “Ausführen” in German):
In the popup-screen, enter “cmd”:
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
5
The command window appears:
Here you need to remember the path where “CMD” takes you. In my case, it is: “D:\Documents and Settings\MY.USERNAME”. In your case, it will be your username instead of my username. And it will probably start with a “C:” instead of a “D:”. The “C:” or “D:” indicate the disk drive on which you data is located. Whether it is “C:”, “D:” or something else, depends on the setup of your computer.
3.2
Find your data
Next, you need to get the name of the path where your user data are stored. To do this, you start the Windows Explorer. If your screen looks like this without address bar, you have to switch the address bar on:
In order to switch on the address bar, you click on “View” (German: Ansicht) in the menu:
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
6
Here you go to “Toolbars” (German: Symbolleisten) and you switch on the address bar:
Now, the address bar is displayed. But the entry “My Documents” or “Eigene Dateien” in German does not really help:
How you can find out the technical path name is explained in the next step.
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
7
To find the technical path name, go to the folder that you have seen in step one in chapter 3.1. Remember? For me, it was “D:\Documents and Settings\MY.USERNAME”:
Normally, you would like to backup the files that are under “My Documents”.
4.
Create myxcopy batch file
4.1
Open a new file in Editor / Notepad
In order to create our batch file, start the Editor (or Notepad). First, go to “Start”, then to “Programs”:
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
8
Next, go to accessories (German: Zubehör) and start the program “Editor”:
First, save your file:
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
9
Please save the file in the same folder that you have found when entering “CMD” for the first time (see chapter 3.1):
Please give the file a name like “MYXCOPY.BAT”. • The .bat -ending tells Windows that the file is executable • The name should be different from XCOPY. (Otherwise I think the command interpreter will be confused.)
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
10
4.2
Enter the command text
In your file myxcyopy.bat enter text like the following: XCOPY "D:\Documents and Settings\MY.USERNAME\My Documents\*" "E:\MYBACKUP\My Documents\" /C/E/H/D/Y
What is the meaning of this and what do you have to change? •
xcopy tells the command interpreter to call the DOS-program XCOPY
•
"D:\Documents and Settings\MY.USERNAME\My Documents\*" is the source location where xcopy copies from. It needs to be in quotation marks, otherwise xcopy can not understand the blank signs in the folder names. Please change the “D:” to your drive letter. Please change MY.USERNAME to your username.
•
"E:\MYBACKUP\My Documents\" is the target location, i.e. the disk and the folder where you want xcopy to put your files. Please change the “E:” to the letter of your external drive.
•
/C/E/H/D/Y are switches that control the execution of XCOPY. They mean: /C – Continue copying even if an error occurred (can happen if a file is opened by another program) /E – Copy all subfolders even if they are empty /H – Copy hidden files /D – Copy files if the source file is newer then the existing target file The /D is very important. It allows making “incremental” backups, which means that after the first full backup only new files and changed files are copied. /Y – Overwrite existing files without asking
Please save this file and close Notepad.
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
11
5.
Run your backup
5.1
First backup
To run your backup batch program, click on Start
, then Execute (German: “Ausführen”):
Enter “CMD” and click OK:
On the command screen, enter the name of your batch file:
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
12
When you hit the <ENTER> key, the execution should start. The command in your batch file and the files that are copied are displayed:
When the copying has finished, you are told how many files were copied:
To finish and close the “CMD”-window, type “exit” and press the <ENTER> key:
If you run this backup for the first time, all your files will be copied. This will probably take some hours. How fast it really is depends on your hardware. Experience shows that 80.000 files with a total volume of 30 GB take about two to three hours for a full backup.
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
13
5.2
Following backups
For following backups, you can use the same batch file myxcopy.bat without any changes! Start the same way as for the initial backup (Start, execute, CMD). If you run the next backup with myxcopy, only new files and files that were changed after the last backup will be copied. For the following demo, I changed two files and added one file:
As a rule of thumb, to run the backup with one weeks amount of changed and new files takes about ten to twenty minutes.
5.3
Deletion of files
If you create your backup batch file as shown, it will not delete any files. If you delete files on your computer or change file or folder names, you have to do it also manual on your backup hard disk.
5.4
Edit myxcopy.bat
In order to edit your batch file, right-click it and then choose Edit (German: “Bearbeiten”):
If you choose open, the execution will start immediately.
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
14
6.
Additional Information
6.1
Using Backup programs
Question: There are plenty of backup programs available. Why not use one of these? Answer from the author: To run your backups regularly, use whatever tool you like. To do it with XCOPY is just one of many possibilities. For me, there are only two things really important about backups:
• Do backups of your data! • Do the backups regularly!
6.2
XCOPY on the web
If you type “xcopy bat” into any search engine, you will get plenty of information. You will also find much more sophisticated ways of creating batch programs using XCOPY. In this document, all the additional features and possibilities were ignored. Just one line of text and your valuable data is saved! From this document, you get a very simple working example of how you can use XCOPY for data backup. The intention of this document is not to give you a lesson on batch programming.
6.3
My personal backup file
Besides the folder “My Documents”, probably you might whish to back up some other folders or files. If you whish to back up the folders “Desktop” and “Favorites” and also the batch files that you have created, your backup batch file could look like this:
If you like to have the text for copying: xcopy "D:\Documents and Settings\MY.USERNAME\My Documents\*" "E:\MYBACKUP\My Documents\" /C/E/H/D/Y xcopy "D:\Documents and Settings\MY.USERNAME\Desktop\*" "E:\MYBACKUP\Desktop\" /C/E/H/D/Y xcopy "D:\Documents and Settings\MY.USERNAME\Favorites\*" "E:\MYBACKUP\Favorites\" /C/E/H/D/Y xcopy "D:\Documents and Settings\MY.USERNAME\*.bat" "G:\BEPCACT\" /C/E/H/D/Y
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
15
7.
Disclaimer
The author has been using this way of backing up data successfully for many years. Nevertheless, no guarantee or promise can be given that this approach also works on your specific hardware or software. You are strongly encouraged to check if all data has been backed up completely and if the copied data is useable. If you follow the advice given in this document, you agree to the following: The correctness, completeness and usability of any data is the users own responsibility. The author can not take any warranty or responsibility and can not be held liable for any data loss or other damage.
How-to-document
Data backup on external hard disk using XCOPY
Please feel free to copy, forward or publish this document
16