DMFIND(1)

NAME

dmfind - Searches for files in a directory hierarchy

SYNOPSIS

dmfind [path-name-list...] [expression]

IMPLEMENTATION

SGI IRIX systems licensed for the Data Migration Facility (DMF)

DESCRIPTION

The dmfind command is based on the IRIX version of find.

The dmfind command recursively descends the directory hierarchy for each path name in the path-name-list (that is, one or more path names) seeking files that match a boolean expression written in the expression. If the expression does not contain at least one of -print, -ok, or -exec, including the case of a null expression, a -print is implicit.

Expressions
The expression is made up of options, tests, and actions, all of which can be separated by operators.

Options differ from the other expressions in that they have an effect on overall operation of the command rather than the processing of a specific file; they always return a true value. Tests process files and return a true or false value. Actions have side effects and return a true or false value. A logical AND is assumed if the operator is omitted.

Options
All options always return true. This means that they always take effect, rather than being processed only when their place in the expression is reached. Therefore, for clarity, most people place them at the beginning of the expression.

dmfind accepts the following Option expressions:

     Option expressions          Description
-depth
Processes the contents of each directory before the directory itself. This can be useful when dmfind is used with cpio(1) to transfer files that are contained in directories without write permission.

-follow
Causes the underlying file of a symbolic link to be checked rather than the symbolic link itself.

-help
Prints a summary of the command-line usage of dmfind and exits.

-mount
Specifies that dmfind should restrict its search to the file system containing the path-name-list.

Tests
Tests are expressions that limit what the dmfind command returns. For example, the following command prints a list of files in the current (working) directory that were accessed within the last hour:

dmfind . -atime 1

All numeric arguments can be specified as follows:

+n
More than n

n
Exactly n

-n
Less than n

The dmfind command accepts the following Test expressions:

     Test expression             Description
-anewer file
Indicates that the path-name-list was last accessed more recently than file was modified. See stat(2) for a description of which file operations change the access time of a file.

-atime [+-]n
Indicates that the file was last accessed n days ago. The definition of n days ago is any time within the interval beginning exactly n*24 hours ago and ending exactly (n-1)*24 hours ago. The + and - prefixes signify more or less than n days ago, respectively. This means that +n is more than n*24 hours ago, and -n is less than n*24 hours ago. See stat(2) for a description of which file operations change the access time of a file. The access time of directories in path-name- list is changed by dmfind itself.

-bfid bfid
Specifies that dmfind should find the file with the specified bit file identifier (bfid) attached to it in the DMF migration process.

-cnewer file
Indicates that the path-name-list was last changed more recently than file was modified. See stat(2) for a description of which file operations change the change time of a file.

-ctime [+-]n
Indicates that the status of the file was last changed n*24 hours ago. See -atime for a complete description of the definition of "24 hours ago".

-state state
Specifies that dmfind should find all files of the specified valid DMF state. Possible values for state follow (values can be abbreviated and are case-insensitive):

                                 Value   Description
REG      File not managed by DMF
MIG      Migrating file
DUL      Dual-state file
OFL      Offline file
UNM      Unmigrating file
NMG      Nonmigratable file
INV      DMF cannot determine the file's state

-fhandle dmapi_file_handle
Specifies that dmfind should find the file with the specified Data Management API (DMAPI) fhandle. The fhandle is the DMF representation of the DMAPI name for the file in the file system.

-fstype type
Indicates that the file is on a file system of type type.

-group gname
Indicates that the file belongs to group gname. If gname is numeric and does not appear in the /etc/group file, it is taken as a group ID.

-inum inode
Indicates that inode is the inode number of the file.

-links n
Indicates that the file has n links.

-local
Indicates that the file physically resides on the local system. Using this test expression causes the search not to descend into remotely mounted file systems.

-mtime [+-]n
Indicates that the data in the file was last modified n*24 hours ago. See -atime for a complete description of the definition of "24 hours ago".

-name file
Indicates that file matches the current file name. Normal shell argument syntax must be escaped. The metacharacters (*, ?, and []) do not match a . at the start of the file name.

-newer file
Indicates that the path-name-list was last modified more recently than file was modified. See stat(2) for a description of which file operations change the modification time of a file.

-nouser
Indicates that the file belongs to a user not in the /etc/passwd file.

-nogroup
Indicates that the file belongs to a group not in the /etc/passwd file.

-perm mode
Indicates that the file's permission bits are exactly mode, which can be an octal number or a symbolic expression of the form used in chmod(1).

-perm -mode
All of the permission bits in mode are set for the file. mode can be an octal number or a symbolic expression of the form used in chmod(1).

-perm +mode
Any of the permission bits in mode are set for the file. mode can be an octal number or a symbolic expression of the form used in chmod(1).

-size [+-]n[c]
Indicates that the file uses n blocks of space. There are 512 bytes per block. If n is followed by a c, the size is in characters.

-type filetype
Locates files of the specified filetype. The filetype is specified by one of the following letters:

b      Block (buffered) special file
c      Character (unbuffered) special file
d      Directory
f      Regular file
l      Symbolic link
p      FIFO or named pipe
s      Sockets

-user uname
Indicates that the file is owned by user uname. If uname is numeric and does not appear as a login name in the /etc/passwd file, it is taken as a user ID.

Actions
Actions are expressions that act on files. They allow you to execute commands from within a dmfind command line. The dmfind command accepts the following Action expressions:

     Action expression           Description
-cpio device
Write the current file on device in cpio(1) format (5120-byte records). This command issues a warning if it encounters a file larger than two gigabytes; you must use the cpio(1) command to archive files larger than two gigabytes.

-exec command ;
Execute command True if the executed command returns a zero value as exit status. The end of command must be punctuated by an escaped semicolon. A command argument {} is replaced by the current path name. To escape constructions, you can use a backslash (\) or quotation marks ("") to protect them from expansion by the shell.

-ok command ;
Like -exec except that the generated command line is printed with a question mark first, and is executed only if the user responds by typing y.

-print
Prints command output to standard output.

-prune
Specifies that dmfind should not examine any directories or files in the directory structure below the pattern just matched. If the current path name is a directory, dmfind does not descend into that directory, provided -depth is not also used.

Operators
The operators are as follows, listed in order of decreasing precedence:

     Operator          Description
( expression )
True if the expression is true. Parentheses are special to the shell and must be escaped.

! expression
True if expression is false.

expr1 expr2
AND (implied); expr2 is not evaluated if expr1 is false.

expr1 -o expr2
OR; expr2 is not evaluated if expr1 is true.

EXIT STATUS

An exit status of 0 (zero) indicates that all path-name-list operands were traversed successfully. An exit status greater than zero indicates that an error occurred.

BUGS

The command dmfind / -depth always fails with the following message:

dmfind: stat failed: : No such file or directory

The dmfind command relies on a completely correct directory hierarchy for its search. In particular, if a directory's .. is missing or incorrect, dmfind fails at that point and issues some number stat failed: messages.

-depth and -prune do not work together well.

EXAMPLES

Example 1: To remove all files named a.out or *.o that have not been accessed for a week, use the following command:

dmfind / \( -name a.out -o -name '*.o' \) -atime +7 -exec rm {} \ ;

Example 2: To display all character special devices on the root file system except those under any dev directory:

dmfind / -mount \( -type d -name dev -prune \) -o -type c -print

FILES

/etc/passwd
Supplies UID information

/etc/group
Supplies GID information

SEE ALSO

dmattr(1) and dmls(1) for other methods of obtaining the DMF state of files

chmod(1) for more information on file permission flags cpio(1) for more information on transferring files located with find rm(1) for more information on deleting files and directories sh(1) for more information on quoting and parameter substitution test(1) for more information on testing conditions

stat(2) for file system information sysfs(2) for file system type information umask(2) for information on setting and getting file creation masks

xfs(4) for the information about the XFS file system

cpio(5) for the format of cpio files