[manual index][section index]

NAME

find - recursively filter and list files

SYNOPSIS

find [ -l/ ] [ -f | -F ] [ -d mindepth ] [ -D maxdepth ] [ -[uU] user ] [ -[gG] group ] [ -[iI] name ] [ -[nN] name ] [ -J name ] [ -T name ] [ -[rR] pathregex ] [ -[pP] perm ] [ -[mM] mode ] path

DESCRIPTION

Find traverses a directory hiearchy, and prints file names. It starts at path, typically but not necessarily a directory, and recursively walks all directories, printing the full path name (which always starts with path) of each file. If option -l was given more information is printed, in a format similar to that of ls(1). Option -/ prints a / after a path if it is a directory. The remaining options filter paths to print and traverse. The next options can only be specified once:

-d mindepth
Minimum depth of file required to print the file, relative to path. Path is at depth 0 (even if it is a plain file). The first file in path is at depth 1.
-D maxdepth
Maximum depth of file to print the file, and traverse if it is a directory.
-f or -F
Print only files in case of -f, or only directories in case of -F. By default, both files and directories are printed. Only one of these options may be specified.

The remaining options can be specified multiple times. For each lower case option a similar upper case option exists, except for -J and -T. Files are printed if they match at least one of the patterns specified with the lower case options, or when no such patterns were specified. But only if the file does not match any of the patterns specified by the upper case options. The options and the file property they check against:


-[uU] user
Owner (uid) of the file.
-[gG] group
Group (gid) of the file.
-[iI] name
Case-insensitive name of the file. Name is interpreted as a file pattern, see filepat(2) for details. This only checks against the name of the file itself, not against the whole path.
-[nN] name
Case-sensitive name of the file. Name is interpreted as a file pattern, see filepat(2) for details. This only checks against the name of the file itself, not against the whole path.
-J name
Case-insensitive compare. Don't print, and stop walking a (sub)tree when it matches.
-T name
Like -J, but with case-sensitive compare.
-[rR] pathregex
Regular expression pathregex is matched against the full path (always starting with path).
-[pP] perm
Permission bits (8r777) of the file, perm is interpreted as octal number.
-[mM] mode
Mode bits (~8r777) of the file. Mode must be a string with one or more of the following characters: d for directory, a for append-only, A for authentication file, l for exclusive-use file.

SOURCE

/appl/cmd/find.b

SEE ALSO

fs(1), ls(1), alphabet-fs(1), du(1), sys-stat(2), filepat(2), regex(6).

BUGS

Only relatively simple selection criteria can be formulated. See fs(1) for more advanced filtering and operations.

Options for filtering on permission mask, and perhaps mode mask, should be offered.

FIND(1 ) Rev:  Wed Feb 22 04:14:06 GMT 2023