- 论坛徽章:
- 0
|
如何查找一个子目录的路径?
Pay attention , Just at the beginning it is "find files"
User Commands find(1)
NAME
find - find files
SYNOPSIS
find path ... expression
DESCRIPTION
The find utility recursively descends the directory hierar-
chy for each path seeking files that match a Boolean expres-
sion written in the primaries given below.
find will be able to descend to arbitrary depths in a file
hierarchy and will not fail due to path length limitations
(unless a path operand specified by the application exceeds
PATH_MAX requirements).
OPERANDS
The following operands are supported:
path A path name of a starting point in the directory
hierarchy.
expression
The first argument that starts with a -, or is a ! or
a (, and all subsequent arguments will be interpreted
as an expression made up of the following primaries
and operators. In the descriptions, wherever n is
used as a primary argument, it will be interpreted as
a decimal integer optionally preceded by a plus (+) or
minus (-) sign, as follows:
+n more than n
n exactly n
-n less than n
Expressions
Valid expressions are:
-atime n
True if the file was accessed n days ago. The access
time of directories in path is changed by find itself.
-cpio device
Always true; write the current file on device in cpio
format (5120-byte records).
-ctime n
True if the file's status was changed n days ago.
-depth
Always true; causes descent of the directory hierarchy
to be done so that all entries in a directory are
acted on before the directory itself.
This can be useful when find is used with cpio(1) to
transfer files that are contained in directories
without write permission.
-exec 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.
-follow
Always true; causes symbolic links to be followed.
When following symbolic links, find keeps track of the
directories visited so that it can detect infinite
loops; for example, such a loop would occur if a sym-
bolic link pointed to an ancestor. This expression
should not be used with the -type l expression.
-fstype type
True if the filesystem to which the file belongs is of
type type.
-group gname
True if the file belongs to the group gname. If gname
is numeric and does not appear in the /etc/group file,
or in the NIS/NIS+ tables, it is taken as a group ID.
-inum n
True if the file has inode number n.
-links n
True if the file has n links.
-local
True if the file system type is not a remote file sys-
tem type as defined in the /etc/dfs/fstypes file. nfs
is used as the default remote filesystem type if the /etc/dfs/fstypes file is not present. Note that -local
will descend the hierarchy of non-local directories.
See EXAMPLES for an example of how to search for local
files without descending.
-ls Always true; prints current path name together with
its associated statistics. These include (respec-
tively):
... ... |
|