BACKUP

The description below is from the book
DOS the Easy Way by Everett Murdock Ph.D. CLICK HERE for information about downloading the book.

BACKUP
Type: External (2.0 and later)

Syntax:

BACKUP [d:][path][filename] [d:][/S][/M][/A][/F:(size] [/P][/D:date] [/T:time] [/L:[d:][path]filename]

Purpose: Makes a backup copy of one or more files. (In DOS Version 6, this program is stored on the DOS supplemental disk.)

Discussion

The first path and filename(s) you enter identify the disk file(s) to be backed up. The second drive specified is the drive where the backup copy will be sent.

If you do not specify the first path, files are backed up from the current directory. If you do not specify a filename or extension, then all files in the directory are backed up.

You can use the wild card characters (* and ?) to specify groups of files to be backed up.

If errors are encountered during the BACKUP process, the ERRORLEVEL exit code is set as follows:

1. No files could be found to back up.
2. Some files were not backed up due to file conflicts.
3. Terminated when you pressed the Ctrl + Break key combination.
4. Terminated due to any other type of error.

These codes can be used with the batch processing IF command to write backup batch files that test for errors during the backup process.

Files backed up using the BACKUP command are stored in a special, compacted format and are therefore not usable for normal file processing. You must use the RESTORE command to recall them and store them in the normal (un-compacted) format.


NOTE:

DOS Versions 3.3 through 5.0 stored backed up files in a different format than earlier versions (the new backup method requires less disk space). In these versions, the BACKUP program creates two files on the backup disk: BACKUP and CONTROL. The BACKUP file will contain all the files that were backed up and the CONTROL file will contain file storage information such as the paths and filenames of the source files.

Options

/A - Does not erase the files on the target disk (DOS normally will erase existing files on the target diskette before it starts backing up the files). Use of this option cancels the prompt to insert a diskette in the target drive before the copying starts, but after the target disk is filled with backed-up files, you will be prompted to insert a new diskette.


NOTE:

The /A option does not work if the files on the backup disk were copied using a BACKUP program in DOS Version of 3.2 or earlier.


/F:(size) - Formats the target disk (if it is not already formatted). This option uses the FORMAT program which must, therefore, be accessible via the current path. In DOS Versions 4 and 5, you can use F:(size) if the capacity of the target diskette does not match that of the drive in which you put it. For example, if you are using a 360K diskette in a 1.2M drive, (size) can be 160, 180, 320, 360, 720, 1.2, 1.44, or (in DOS Version 5) 2.88.

/L - Makes an entry in the backup log in the file you specify here. If you use this option but do not specify a backup log file, the system creates the file BACKUP.LOG in the root directory of the source drive.

The backup log will contain:

1. The date and time that the files were backed up.
2. The name of the file that was backed up.
3. The number of the backup disk that contains the file.

The information stored in this file can be used when you want to restore a particular file from a backup disk.

If the backup log file you specify already exists, the current entry is added to the existing file.

/M - Only backs up files that have been modified since the last time the BACKUP command was used. This switch checks the archive attribute of a file. If the file`s archive attribute is set to off (-A), the file will not be backed up.


NOTE:

If you are backing up files from a diskette, do not write-protect them. BACKUP changes the archive attribute of each file as it is backed up.

/P - Packs as many files as possible onto each diskette. This option will create a directory when that is the only way to pack more files onto the diskette.

/S - Causes files in the specified directory and all subdirectories below the specified directory to be backed up.

/D:(date) - Backs up files only if they have been created or modified on or after the date you enter.

/T:(time) - Backs up files only if they have been created or modified on or after the time you enter.

Example

In the following example, all files in the drive C LETTERS directory that begin with SALE and with any filename extension are backed up onto the disk in drive A.

backup c:\letters\sale*.* a:

BACKUP will display a prompt when it is time to insert the disks. If the /A option is not used, there will also be a warning that any files currently stored on the target disk will be erased.

For more information about this command, refer to the downloadable book DOS the Easy Way.

Copyright 1985 - 2003 by Everett Murdock



Back to the Easy DOS Command Index