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

MPW Command Reference


WhereIs

Tool

SYNTAX

WhereIs pattern… [-c] [-d] [-s directory] [-v] [-x]

DESCRIPTION

The WhereIs tool finds all files that contain pattern as part of their filenames and writes their full pathnames. This allows you to find files hidden in the directory tree. Normally, WhereIs starts searching in the root directory of the default volume and searches the entire disk.

In addition to finding files in this manner, you can use WhereIs to

list all files and directories that contain pattern (-d)

limit the search to files that completely match pattern (-c)

limit the search to a portion of the disk or to a specific disk or multiple disks (-s)

Note that matching is not case sensitive and that pathnames containing special characters are enclosed in quotation marks.

INPUT

None

OUTPUT

Standard output. WhereIs writes the full pathname of any file that contains pattern to standard output. If you specify -v, WhereIs also writes the total number of files and directories that match pattern.

ALIAS RESOLUTION

Resolves Finder aliases when processing the -s option only. There is no other alias resolution.

STATUS

WhereIs can return the following status codes:

0

no errors

1

syntax error

2

file system error during processing

3

no matches found

PARAMETERS

pattern

Specifies one or more patterns to match. For example, a pattern of DAEntry matches

'HD:MPW Exp:CExamples:DAEntry.a'
'HD:MPW Exp:PExamples:DAEntry.a'
'HD:MPW Exp:PExamples:DAEntry.a.o'

OPTIONS

-c

Lists only files that match pattern completely. If you specify this option, WhereIs treats pattern as if it were a filename.

-d

Lists all files and directories that contain pattern in their names. Normally, WhereIs lists only files.

-s directory

Starts searching for matches in the specified directory. Normally WhereIs starts searching in the root directory of the default volume.

Searching a large hard disk can take several minutes; this option speeds up the search when you know the general location of a file.

Note
You can specify multiple starting directories, but each must be preceded by -s. •

-v

Writes a summary line with the number of files and directories matched.

-x

Uses the original directory-walking search method instead of the new method. The original search method may be faster when searching a subset of an entire disk.

EXAMPLES

The command line

WhereIs test

finds all files that have test in their filename and writes their full pathnames to standard output like this:

HD:MPW:test.c
HD:MPW:test.c.o
HD:MPW:TestMenu.c
HD:MPW:TestProg.p

This command line finds files named test.c:

WhereIs test.c -c

The output (with the same files as the example above) is

HD:MPW:test.c

The following command line finds all files and directories that have test in their leafnames, searching HD:MPW first, and then Disk2:Work.

WhereIs test -d -s HD:MPW -s Disk2:Work

This produces the output

HD:MPW:TestDir:
HD:MPW:test.c
HD:MPW:test.c.o
Disk2:Work:TestMenu.c
Disk2:Work:TestProg.p

LIMITATIONS

WhereIs does not support regular expressions.

 
 


Last Updated September 2000