cs:navody:ssh:dmfind

Toto je starší verze dokumentu!


DMFIND

NAME
SYNOPSIS
IMPLEMENTATION
DESCRIPTION
OPTIONS
EXIT STATUS
BUGS
EXAMPLES
FILES
NOTES
COPYRIGHT
SEE ALSO

NAME

dmfind − Searches for files in a directory hierarchy

SYNOPSIS

dmfind [-H] [-L] [-P] [path-name-list...] [expression]

IMPLEMENTATION

SGI systems licensed for the Data Migration Facility (DMF) and systems functioning as DMF clients.

DESCRIPTION

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, -exec, or -execdir, including the case of a null expression, a -print is implicit.

OPTIONS

The ‘-H’, ‘-L’ and ‘-P’ command line options control the treatment of symbolic links. If specified, the command line options ‘-H’, ‘-L’ and ‘-P’ must appear before the first path name.

-H

Do not follow symbolic links, except while processing the command line arguments. When dmfind examines or prints information about files, the information used shall be taken from the properties of the symbolic link itself.

-L

Follow symbolic links. When dmfind examines or prints information about files, the information used shall be taken from the properties of the file to which the link points, not from the link itself (unless it is a broken symbolic link or dmfind is unable to examine the file to which the link points).

-P

Never follow symbolic links. This is the default behaviour.

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.

-xdev

Specifies that dmfind should restrict its search to the file system containing the path-name-list. Don’t descend directories on other filesystems.

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

-amin [+-]n

File was last accessed n minutes ago. See stat(2) for a description of which file operations change the access time of a file.

-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. See dmattr(1) for a description of bit file identifiers.

-cmin [+-]n

The file’s status was last changed n minutes ago. See stat(2) for a description of which file operations change the change time of a file.

-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".

-empty

File or directory is empty.

-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.

-iname pattern

Like -name, but the match is case insensitive. For example, the patterns ‘fo*’ and ‘F??’ match the file names ‘Foo’, ‘FOO’, ‘foo’, ‘fOo’, etc. Unlike filename expansion by the shell, an initial ’.’ can be matched by a ’*’ in the pattern. For example, find -name *bar will match the file ‘.foobar’. Please note that you should quote patterns as a matter of course, otherwise the shell will expand any wildcard characters contained in the pattern.

-inum inode

Indicates that inode is the inode number of the file.

-links n

Indicates that the file has n links.

-maxdepth n

True if the current search depth is less than or equal to n.

-mindepth n

True if the current search depth is greater than or equal to n.

-mmin [+-]n

File’s data was last modified n minutes ago. See stat(2) for a description of which file operations change the modification time of a file.

-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 pattern

Indicates that pattern 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.

-nogroup

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

-nouser

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

-path pattern

File name matches shell pattern pattern. The metacharacters do not treat ‘/’ or ‘.’ specially. For example,

         find . -path ’./sr*sc’

will print an entry for a directory called ’./src/misc’ (if one exists). To ignore a whole directory tree, use -prune rather than checking every file in the tree. For example, to skip the directory ‘src/emacs’ and all files and directories under it, and print the names of the other files found, do something like this:

         find . -path ’./src/emacs’ -prune -o -print

-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.

-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

ARC

Archiving file

DUL

Dual-state file

OFL

Offline file

UNM

Unmigrating file

NMG

Nonmigratable file

PAR

Partial-state file

INV

DMF cannot determine the file’s state

-tag [+-]n

Indicates that the file on a

DMF managed filesystem has sitetag n. See dmtag(1) for more information on DMF sitetags.

-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

-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.

-execdir command ;

Like -exec except that the command is executed from the directory containing the file.

-ls

True; list current file in ‘ls -dils’ format to standard output.

-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. This is assumed if neither -ok nor -exec are specified.

-print0

True; print the full file name to standard output, followed by a null character (instead of the newline character that ‘-print’ uses). This allows file names that contain newlines or other types of white space to be correctly interpreted by programs that process the dmfind output. This option corresponds to the ‘-0’ option of xargs.

-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 -a expr2

Another form of the AND operator.

expr1 -and expr2

Another form of the AND operator.

expr1 -o expr2

OR; expr2 is not evaluated if expr1 is true.

expr1 -or expr2

Another form of the OR operator.

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 / -xdev \( -type d -name dev -prune \) -o -type c -print

Example 3: To recall all offline files in a directory tree:

  dmfind . -state OFL | dmget
Note that piping the pathnames directly into dmget is much more efficient
than the use of the -exec option or the xargs command.
dmattr, dmput and dmtag also accept pathnames on their
standard input file.

FILES

/etc/passwd

Supplies UID information

/etc/group

Supplies GID information

NOTES

The dmfind command was rewritten in DMF 3.7.0. As a result of the rewrite, the following dmfind options were removed : d, f, h, X, x, help, verbose. The following expressions were removed: cpio, flags, mount, ncpio, noproj, proj, label, xlabel, dominates, dominated. On IRIX and SGI ProPack on SGI Altix ia64 systems, please see the sgi_dmfind(1) man page for more information about these options.

COPYRIGHT

Copyright (c) 2007 SGI. All rights reserved.

Copyright (c) 1990, 1993 The Regents of the University of California. All rights reserved.

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


Poslední úprava:: 29.10.2012 15:27