Gemmer en sikkerhedskopi af en eller flere filer - som regel på et andet drev.
Backs up one or more files from one disk onto another.
You can back up files onto either a hard disk or floppy disk(s).
Files can also be backed up from one floppy disk onto another, even
if the disks have different numbers of sides or sectors. MS-DOS displays
the name of each file it backs up.
SYNTAX
------
BACKUP source destination-drive: [/S] [/M] [/A][/F[:size]]
[/D:date [/T:time]][/L[:[drive:][path]logfile]]
PARAMETERS
----------
source
Specifies the location of files you want to back up.
Source can consist of a drive letter and colon, a directory name,
a filename, or a combination.
destination-drive:
Specifies the drive that contains the disk on which you want to store
any backup files. The backup files are stored in the BACKUP.nnn and
CONTROL.nnn files. That is, BACKUP assigns the names BACKUP.001
and CONTROL.001 to the files it creates on the first backup disk you
use, BACKUP.002 and CONTROL.002 to the files it creates on the second
backup disk, and so on.
SWITCHES
/S
Backs up the contents of all subdirectories.
/M
Backs up only files that have changed since the last backup,
and turns off the archive attribute of the original files.
/A
Adds backup files to an existing backup disk without deleting
existing files. (The /A switch is ignored if the existing backup
disk contains backup files that were created by using the BACKUP
command from MS-DOS version 3.2 or earlier.)
/F[:size]
Formats the backup disk to the size you specify. (The FORMAT command
must be present in the current path.) With this switch, you direct
BACKUP to format floppy disks that do not match the default size of
the drive. The BACKUP command formats an unformatted destination disk
even if you do not specify the /F switch. When BACKUP finishes
formatting, it begins backing up files onto the last disk it formatted.
Size specifies the size in kilobytes of the disk to be formatted. If
you do not specify size, the /F switch uses the default size of the
drive. The following list shows the valid values for size and a brief
description of each size:
160 or 160k or 160kb
160K, single-sided, double-density, 5.25-inch disk
180 or 180k or 180kb
180K, single-sided, double-density, 5.25-inch disk
320 or 320k or 320kb
320K, double-sided, double-density, 5.25-inch disk
360 or 360k or 360kb
360K, double-sided, double-density, 5.25-inch disk
720 or 720k or 720kb
720K, double-sided, double-density, 3.5-inch disk
1200 or 1200k or 1200kb or 1.2 or 1.2m or 1.2mb
1.2-MB, double-sided, quadruple-density, 5.25-inch disk
1440 or 1440k or 1440kb or 1.44 or 1.44m or 1.44mb
1.44-MB, double-sided, quadruple-density, 3.5-inch disk
2880 or 2880k or 2880kb or 2.88 or 2.88m or 2.88mb
2.88-MB, double-sided, 3.5-inch disk
/D:date
Backs up only files modified on or after the specified date. The
date format depends on the setting you are using for the COUNTRY
command.
/T:time Backs up only files modified at or after the specified time.
The time format depends on the setting you are using for the COUNTRY
command.
/L[:[drive:][path]logfile]
Creates a log file and adds an entry to that file to record the
backup operation. If you do not specify a location for the log file,
BACKUP puts the file in the root directory of the source drive. If
you do not specify logfile, BACKUP names the file BACKUP.LOG. You
should not specify a removable drive (such as a floppy disk drive)
for this parameter; but once the backup is complete, you can copy the
log file to a floppy disk.
NOTES
-----
Backing up onto a disk with files
---------------------------------
Unless you use the /A switch, BACKUP deletes old files (including
read-only files) from a backup disk before adding new files to it.
Backup log file
---------------
If you use the /L switch and do not specify a name and location for
the log file, the BACKUP command adds a file named BACKUP.LOG to the
root directory of the source drive. If the BACKUP.LOG file already
exists, BACKUP adds the current entry to the file. A backup log-file
entry uses the following format:
o The date and time of the backup appear on the first line.
o Each filename appears on a separate line with the number of
the backup disk that contains the file.
The backup log file can assist you later, when you need to identify
the files you want to restore. The RESTORE command always returns a
file to the original directory or subdirectory recorded in the backup
log, creating the subdirectory if necessary.
Labeling backup disks
---------------------
It is important to label and number backup disks consecutively. As each
disk is filled, BACKUP prompts you for the next disk. When you restore
files, you need to insert the backup disks into the disk drive in the
same sequence. To check the sequence of backup disks (MS-DOS version 3.3
or later), use the DIR command to check the disk number.
BACKUP and system files
-----------------------
The BACKUP command cannot back up the system files IO.SYS, MSDOS.SYS,
and COMMAND.COM. You can use the SYS command to copy these files onto
a floppy disk.
Using an old version of the RESTORE command
-------------------------------------------
You cannot use an old version of the RESTORE command (MS-DOS version
3.2 or earlier) for files backed up with MS-DOS version 3.3 or later.
If you attempt this, MS-DOS displays the following message:
Source does not contain backup files
This error occurs because the format of old backup files differs from
the format of files backed up with MS-DOS versions 3.3 and later.
Using BACKUP with networks or redirected drives or directories
--------------------------------------------------------------
If you are sharing files on a network, you can back up only those
files to which you have access. You should not use BACKUP with a drive
that has been redirected with the ASSIGN, JOIN, or SUBST command. If you
do, the RESTORE command may not be able to restore the files.
Backup exit codes
-----------------
The following list shows each exit code and a brief description of its
meaning:
0 The backup was successful.
1 No files were found to back up.
2 Some files were not backed up because of file-sharing conflicts.
3 The user pressed CTRL+C to stop the process.
4 The process stopped because of an error.
You can use the ERRORLEVEL parameter on the IF command line in a
batch program to process exit codes returned by the BACKUP command.
EXAMPLES
--------
Suppose you want to back up all the files in the \PUBLIC\SMITH directory
on drive C onto a blank, formatted disk in drive A. To do so, type the
following:
BACKUP C:\PUBLIC\SMITH\*.* A:
Suppose you need to back up all files in the \PUBLIC\SMITH directory
on drive C onto a 720K floppy disk in drive B. If the floppy disk is
unformatted, BACKUP formats it before backing up any files. Because the
/S switch is not specified in the following command, files in
subdirectories are not backed up:
BACKUP C:\PUBLIC\SMITH\*.* B: /F:720K
To write a simple batch program named SMITH that supports the BACKUP
command's exit codes and the /S switch, you can type the following
commands by using MS-DOS Editor:
echo off
rem Smith's backup command
backup c:\public\smith\*.* b: /s
if errorlevel 4 goto error
if errorlevel 3 goto abort
if errorlevel 2 goto conflict
if errorlevel 1 goto no_files
if errorlevel 0 goto success
:error
echo Backup stopped the process due to an error
goto exit
:abort
echo You just pressed CTRL+C to stop the backup
goto exit
:conflict
echo One or more files were not backed up due to a sharing conflict
goto exit
:no_files
echo Sorry, but there were no files to back up
goto exit
:success
echo The backup was successful
goto exit
:exit