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

MPW Command Reference


Newer

Built-in

SYNTAX

Newer file1 [file2]… target [-c] [-e] [-noResolve] [-q]

DESCRIPTION

The Newer command compares the modification or creation (-c) date of one or more files to that of a target file or directory and writes to standard output the names of those files that are more recent than the target.

INPUT

None

OUTPUT

Standard output. The newer files are written to standard output, one per line, exactly as they appear on the command line.

ALIAS RESOLUTION

This command resolves Finder aliases used as part of any pathname or filename. If you want to compare the modification or creation dates of one or more Finder alias files, you can use the -noResolve option to prevent Newer from resolving leaf aliases.

STATUS

Newer can return the following status codes:

0

no errors

1

syntax error

2

file not found

PARAMETERS

file1 [file2]…

Names one or more files.

target

Indicates the target file or directory. If you specify a nonexistent file or directory as the target, all existing files in the file parameter are considered newer than the target.

OPTIONS

-c

Compares creation dates instead of modification dates.

-e

Writes the name of files with modification dates equal to that of the target. (Files with identical creation dates are written to standard output if you also specify -c.)

-noResolve

Inhibits resolution of leaf Finder aliases in pathnames so you can compare the modification or revision dates of Finder alias files.

-q

Inhibits placing quotation marks around pathnames that are written to standard output.

EXAMPLES

In this example, Newer writes main.c to standard output if its modification date is more recent than its backup:

Newer main.c main.c.bak

Using the ≈ wildcard character, the following command line lists all the source files in the Source directory that have been modified more recently than TimeStamp :

Newer HD:Source:≈.c HD:TimeStamp

Upon executing the following script, the MPW Shell makes a backup copy of main.c only if it has been modified since the last backup was made.

If `Newer main.c main.c.bak`
  Duplicate main.c main.c.bak
End

Using the same looping mechanism as the previous script, the following script rebuilds the file.c source file if either file.c or file.h has been modified since file.c.o was last built.

If "`Newer File.c File.h File.c.o`"
  SC File.c -o file.c.o
End

 
 


Last Updated July 2000