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

MPW Command Reference


Equal

Built-in

SYNTAX

Equal name1 [name2]… targetName [-d | -r] [-i] [-n count | -q] [-p]

DESCRIPTION

The Equal command compares one or more files, directories, or volumes (name1 [name2]…) with another file or directory (targetName) and returns the fork (data or resource) and byte at which they first differ. When comparing directories, Equal reports all differences in the contents of the data and resource forks, not just the first.

If the files and directories in both parameters are identical, the command does not write any output.

INPUT

None

OUTPUT

Standard output. The Equal command writes to standard output the fork and byte at which each difference occurs.

ALIAS RESOLUTION

This command does not resolve Finder aliases used as part of any pathname or filename unless you use the -resolve option.

STATUS

Equal can return the following status codes:

0

identical files

1

syntax error

2

unable to find name1 [name2]… or targetName parameter

3

files not equal

PARAMETERS

name1 [name2]…

Specifies one or more files, directories, or volumes to be compared with targetName. If you specify one or more files for this parameter, Equal compares it with the targetName file or files of the same name within the targetName directory.

If you specify this parameter as a directory or volume, targetName must be a directory. When specified alone, the directory or volume name is compared directly with the targetName directory. Otherwise, Equal compares all items in this parameter with the corresponding items in targetName.

targetName

Specifies a file or directory to be compared with the items in the name1 [name2]… parameter. Note that if targetName is a file, name must also be a file.

OPTIONS

-d

Compares data forks only.

-i

Ignores files in the targetName directory that do not exist in name. This means that Equal does not report missing files as differences.

-n count

Specifies the number of differences displayed before aborting the comparison. Count may be either a decimal or hexadecimal number. Note that the hexadecimal format requires the digits to be preceded by either "$" or "0x". The -q option causes this option to be ignored.

-p

Writes progress information while comparing files.

-q

Returns "quiet" output, generating only status codes instead of writing explicit differences. Use this option, for example, when writing a script that requires only a status code.

-r

Compares resource forks only.

-resolve

Resolves Finder aliases used as part of any pathname or filename. If you are comparing two folders, however, Equal does not perform alias resolution but instead treats any alias files in the folder as normal files--that is, it compares them only for binary equality.

EXAMPLES

Using the Count.c and Count.c.2 files as parameters, the command line

Equal Count.c Count.c.2

reports the point at which the files initially differ, in a message such as

"Count.c" "Count.c.2" differ in resource fork, at byte 323

The following command line compares all files and directories in HD:Dir1 with files and directories with the same names found in Disk1:Dir1, and then it reports any differences. Note that this command does not report any files in Disk1:Dir1 that do not exist in HD:Dir1.

Equal HD:Dir1 Disk1:Dir1 -i

The following command line compares the data forks of all files on the volume Backup with all those of the same name in the directory HD:Source.

Equal Backup: HD:Source -i -d

The following command line uses the ≈ wildcard character to compare all files in the Old directory that end with ".c" with their counterparts in HD:Source. The Equal command prints progress information as the comparison proceeds.

Equal :Old:≈.c HD:Source -p

SEE ALSO

Compare

 
 


Last Updated July 2000