Backs up one or more files from one disk onto another.
backup [source] destination-drive: [/s] [/m] [/a] [/f:size] [/d:date [/t:time] [/I[:[drive:][path]logfile]
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.
[/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 back up 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 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. Do not use the /t switch without the /d switch
[/I[:[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 the 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.
· The date and time of the backup appear on the first line.
· 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.
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 error level parameter on the if command line in a batch program to process exit codes returned by the backup command.