Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


Backup

Tool

SYNTAX

Backup [[file1] [file2]… | [-from folder | drive]] [-a] [-alt] [-ay]
[-busy folder] [-c] [-check checkOpt[,checkOpt]…] [-co filename]
[-compare [only][,'options…' | .]] [-d] [-do [only][,'commandString']]
[-e] [-l] [-lastcmd command] [-level nestingLevel] [-m] [-n] [-noAlias]
[-p] [-r] [-revert] [-since [date][,time] | ,[time] | filename]
[-sync] [-t type] [-to folder | drive] [-y]

DESCRIPTION

The Backup tool allows you to update your files by copying them from a source to a destination, based on their modification dates. Files in the source can be specified by either filename ([file1] [file2]…) or by the folder or drive in which they are contained (-from folder | drive). These files can be copied to a destination folder or drive (-to folder | drive).

The default operation of Backup assumes that you already have an existing folder in two locations, typically a hard disk and one or more floppy disks, and that you want to make sure that the files in the folder are the same in both places. Thus the files on the destination (-to) disk or drive determine which files can be copied from the source (-from).

Backup generates Duplicate commands to copy files if two conditions are true:

The files already exist on both the source and destination. You can override this condition using the -a option.

The modification date of the source is newer than that of the destination.

Upon execution, these commands duplicate the files that have changed since the last time you updated them.

Among other things, Backup also allows you to determine why it generates Duplicate commands for certain files and not others. You can generate Compare commands for out-of-date files of type 'TEXT' to discover why they are different (-compare). You can also have Backup display filenames that exist in one location only, folder names that do not exist in the destination, and filenames in the destination that are newer than those in the source (-check).

INPUT

None

OUTPUT

For each file to be copied, the MPW Shell writes a Duplicate command to standard output as follows:

Duplicate -y fromFile toFile

When executed, this command copies the file (fromFile) in the source folder or drive to the corresponding file (toFile) in the destination folder or drive. Since Duplicate commands are generated for each file to be copied from the source to the destination, executing these commands assures that corresponding files on the source and destination are exactly the same and are the newest version.

Note that you can suppress the Duplicate command's -y option, which overwrites existing files and folders by automatically answering "Yes" to all dialog boxes, using the Backup command's -y option.

If you use the -compare option, the MPW Shell writes a Compare command to standard output. Other options that write specific commands to standard output are -a, -c, -d, -do, -l, -lastcmd, -n, -revert, -since, and -sync.

The -check option causes Backup to write a diagnostic report to the file you specify by using either redirection or -co filename. Progress information (-p) can also be sent to diagnostic output.

ALIAS RESOLUTION

The Backup command resolves all Finder aliases used as part of a pathname specified by the -from folder and -to folder options. Aliases located in either of these directories are handled by Backup in the same way as it does any other file. The -noAlias option prevents any aliases from being copied, written over, or deleted.

STATUS

Backup can return the following status codes:

0

no errors

1

syntax error

3

no errors and no files to duplicate or list

Note
Backup returns a status code of 3 when no files need copying. If no files are copied because none of the files in the source folder exist in the destination folder, Backup produces a warning. If no names match, it is possible that you specified the source and destination incorrectly. Note that Backup does not report this as an error if you use the -l, -a, or -since options. •

PARAMETERS

file1 [file2]…

Specifies the source files to be backed up. You can use the MPW Shell wildcard character ≈ to do limited pattern matching when specifying source files in this manner. See the description of the -from option for another way to specify source files. Note that you cannot specify -from in conjunction with this parameter.

If you do not specify either the file parameter or the -from option, Backup uses drive 1 (that is, -from 1) as long as you specify the -to option.

OPTIONS

-a

Forces Backup to generate MPW Shell Duplicate commands for files in the source that do not exist in the destination location.

-alt

Alternates drive numbers when Backup asks for additional disks. To use this option, you must specify the -m option and a disk drive (1 or 2) as a parameter to either -from or -to, but not both. You cannot specify a drive number as a parameter to both -from and -to because Backup cannot duplicate files when both the source and destination files are on multiple disks.

-ay

Suppresses the display of a confirmation dialog box when you delete an alias.

-busy folder

Forces Backup to generate MPW Shell Move commands for files in the source that are busy in the destination location. The purpose of this command is to move all busy files into the folder you specify before duplicating them. The Move command appears immediately before the Duplicate command for that file.

-c

Generates an MPW Shell Newfolder command when a folder name does not exist in the destination disk and there are files in the source to copy. Note that this option makes sense only if you are using it in conjunction with -a. You can use -c with the -since option to preserve your source folder hierarchy when you copy files to another destination. See the upcoming description of -since for details.

-check checkOpt[,checkOpt]…

Produces the specified diagnostic reports on the source and destination. You can specify one or more of the following checkOpt parameters:

from

Reports all files in the source (-from or file) folder that do not exist in the destination (-to).

to

Reports all files in the destination (-to) folder that do not exist in the source (-from or file).

allfroms

Reports all source folders processed, even if there are no files in that folder to report.

alltos

Reports all destination folders processed, even if there are no files in that folder to report.

folders

Reports all source (-from) folders that do not exist as destination (-to) folders when recursively (-r) processing folders. Note that only the outermost folder names are reported. If you have specified the -c option, which generates a destination folder, no folders are listed.

newer

Reports all files in the destination (-to) that are newer than their source files (-from).

Note
This option is ignored if you use -since. •

-co filename

Redirects the diagnostic report from the -check option to the specified file. Normally, Backup writes the -check report to diagnostic output.

-compare [only][,'options…' | .]

Generates Compare commands for all files of type 'TEXT'. If you want only Compare commands, without the Duplicate commands, specify only.

only

Generates only Compare commands.

,'options…' | .

Allows you to specify Compare command options and output redirection. Make sure that you include the correct Compare options, because Backup does not check for you.

Use a period (.) to indicate no Compare options.

Note
Enclose Compare options in single quotation marks to ensure that they are not used as Backup options. •

-d

Generates Delete commands for all files in the destination (-to) folder that do not exist in the source (-from). If you specify this option, you cannot use the -check to, -check alltos, -m, -l, or -since options.

-do [only] [,'commandString']

Generates the specified command string for all files that are to be duplicated. If you want only the command string, without the Duplicate commands, specify only.

only

Generates only commandString commands. Do not specify -do only in conjunction with -compare only.

commandString

Specifies a string of commands for all files to be duplicated. Note that multiple commands must be separated by semicolons and that the entire command string must be enclosed in quotation marks.

When Backup generates the command string, it adds source (-from) and destination (-to) pathnames as the last two (or only) parameters like this:

commandString fromFileName toFileName

If you specify -sync, Backup generates the same command but with one additional parameter (-sync) to indicate the direction. If the source has a newer modification date than the destination, which is the standard mode for copying the source to the destination, Backup generates a command string like this:

commandString fromFileName toFileName '-->'

If the destination has a newer modification date than the source, Backup generates the following command string:

commandString fromFileName toFileName '<--'

If you specify -l, Backup assumes -do only and generates a command string rather than a directory listing for each source (-from) file, like this:

commandString fromFileName

-e

Ejects the disk from drive 1 or 2 when a floppy disk drive is specified as a parameter to the -from or -to options. Disks are ejected on termination if no files duplicate. Otherwise, Backup generates an MPW Shell Eject command following the Duplicate commands.

Backup ignores this option if you specify -m.

-from folder | drive

Specifies the folder or floppy disk drive in which the source files are located. See the file1 [file2]… parameter for another way to specify source files. Note that you cannot specify this option in conjunction with that parameter.

If you do not specify either the -from option or file1 [file2]… parameter, Backup uses drive 1 (that is, -from 1) as long as you explicitly specify the -to option. You must specify -from if you omit -to or use -l.

folder

Specifies the folder in which the source files are located. You can use the MPW Shell wildcard character to do limited pattern matching when specifying -from folder. However, you must quote such folder specifications to allow Backup, rather than the MPW Shell, to process the pattern.

Using -from folder is more efficient than listing files using the file parameter, but the latter allows more complicated patterns.

drive

Specifies the floppy disk drive number (1 or 2) in which the source files are located.

-l

Generates a list of all files in the source (-from) folder. Do not use -to in conjunction with this option. If you also specify -do, Backup generates the specified command string for each file instead.

-lastcmd command

Generates the specified command following the MPW Shell Duplicate commands. For example, you could specify a Beep command to signal completion of the backup.

-level nestingLevel

Specifies the minimum nesting level at which folders existing in the source but not the destination are duplicated. To use this option, you must also specify -a, which allows the duplication of files not existing in the destination; -c, which creates a folder; and -r, which processes folders recursively.

Backup considers the nestingLevel parameter to be the nesting level relative to the folder specified by the -from option. The -from folder is level 0, the folder within it level 1, and so on.

-m

Allows the duplication of files on multiple disks. Backup displays a dialog box asking for additional disks to be mounted in drive 1 or 2, depending on which drive is specified by -from or -to. Note that Backup ignores this option if you specify drives for both the -from and -to options.

If you specify -e in conjunction with this option, Backup ignores -e.

-n

Generates Duplicate commands for files nested in inner folders with leading spaces to show the nesting structure. To use this option, you must also specify -r.

-noAlias

Prevents the generation of commands that would copy, replace, or delete Finder alias files.

-p

Writes progress and summary information, including the version number of the Backup tool and a report of all Duplicate commands, to diagnostic output. The report is not produced if the diagnostic output file and standard output are the same.

-r

Processes subfolders recursively. Note that Backup does not allow you to copy from or to multiple disks (-m) with recursion (-r).

-revert

Reverts all newer files in the destination (-to) folder to the earlier version found in the source (-from or file).

Normally, Backup does not generate Duplicate commands for a source file unless the modification date shows that it is newer than the file in the destination folder. Specifying -revert reverses the copy criteria, duplicating a file only if it is older than the file in the destination folder.

-since [date][,time] | ,[time] | filename

Generates Duplicate commands for all files in the source (-from) folders that have changed since the specified date and time, or since the modification date and time of the specified file. This option maintains the hierarchical structure of the source folder wherever it appears on the destination folder; that is, the Duplicate commands copy the files from the source folders to the corresponding destination folders. If used with the -c option, -since generates additional subfolders in the destination folder to preserve the source folder's hierarchy.

This option allows you to unconditionally copy files that satisfy the date and time requirements. For example, you can use this option to copy to a single disk all files that have changed since a certain time.

date

Specifies the minimum modification date in the form mm/dd/yy. You can omit the day (dd) or year (yy), or both.

If you omit date, Backup defaults to the current date. If you omit both date and time, you must still type a comma.

time

Specifies the minimum modification time in the form hh:mm:ss. You can omit the minutes (mm) or seconds (ss), or both.

If you omit time, Backup defaults to 00:00:00.

filename

Specifies the minimum modification date as that of the specified file.

-sync

Synchronizes both source and destination files and folders by copying files in both directions. The -sync option cannot be used with the -revert, -since, or -a options.

Note
Use this option with caution, because it can copy in the opposite direction from that specified by -from and -to. It can be used safely, however, with the -compare only option. Used in conjunction with -sync, this option generates Compare commands for all 'TEXT' files that differ in their modification dates, regardless of whether the files in the destination folder or drive are newer than those in the source. •

-t type

Duplicates only files of the specified type (for example, 'TEXT' or 'CODE').

-to folder | drive

Copies source files to the destination folder or drive. If you omit -to but explicitly specify -from or file1 [file2]…, Backup defaults to drive 1 (that is, -to 1). You must specify -to if you omit -from.

folder

Specifies the folder in which the destination files are located.

drive

Specifies the floppy disk drive (1 or 2) in which the destination files are located.

-y

Suppresses generation of the Duplicate command's -y option. The Backup command's -y option serves as a precaution against accidently overwriting important information because the Duplicate command's -y option causes the command to automatically overwrite conflicting folders and files.

EXAMPLES

The following command line copies the files in the {MPW}Work folder to the corresponding files on the floppy disk in drive 2. Note that the files must already exist in both locations and that the files in {MPW}Work must be newer than the corresponding files in drive 2.

Backup -from {MPW}Work: -to 2

Before backing up the source files, the following command line compares the modification date of the files on the floppy disk in drive 1 (-to is omitted, so the destination is drive 1 by default) with that of the files in myFolder. If the files on the disk in drive 1 are newer than those in myFolder, Backup ejects the disk. Otherwise, Backup generates the appropriate Duplicate commands to update the out-of-date files on the disk in drive 1. An Eject 1 command follows the Duplicate commands to eject the disk upon termination.

Backup -from :myFolder: -e

In the following example, Backup recursively processes (-r) all the files in all the folders in myServer:Work, generating the appropriate Duplicate commands to copy out-of-date files to the folders in {MPW}. It is assumed that the folder names in :{MPW} are the same as those in myServer:Work. Any folders in myServer:Work that do not exist in :{MPW}are skipped; however, -check writes a list of all the skipped folders to diagnostic output.

Backup -r -from myServer:Work: -to :{MPW} -check folders

LIMITATIONS

Backup does not support copying from or to multiple disks (-m) with recursion (-r).

Backup ignores the -e option if you specify -m.

Drive numbers other than 1 or 2 are not accepted for the drive parameter. In addition, Backup assumes that floppy disk drives are ejectable.

SEE ALSO

Compare

Duplicate

Move

 
 


Last Updated July 2000