Documentation
¶
Overview ¶
Package find implements the find builtin command.
find — search for files in a directory hierarchy
Usage: find [-H] [-L] [-P] [PATH...] [EXPRESSION]
Search the directory tree rooted at each PATH, evaluating the given EXPRESSION for each file found. If no PATH is given, the current directory (.) is used. If no EXPRESSION is given, -print is implied.
Global options:
--help Print usage information and exit. -L Follow symbolic links.
Supported predicates:
-name PATTERN — basename matches shell glob PATTERN
-iname PATTERN — like -name but case-insensitive
-path PATTERN — full path matches shell glob PATTERN
-ipath PATTERN — like -path but case-insensitive
-type TYPE — file type: b,c,d,f,l,p,s. Comma-separated for OR.
-size N[cwbkMG] — file size. +N = greater, -N = less, N = exact.
-empty — empty regular file or directory
-newer FILE — modified more recently than FILE
-mtime N — modified N days ago (+N = more, -N = less)
-mmin N — modified N minutes ago (+N = more, -N = less)
-perm MODE — permission bits match MODE (octal or symbolic)
-maxdepth N — descend at most N levels
-mindepth N — apply tests only at depth >= N
-print — print path followed by newline
-print0 — print path followed by NUL
-prune — skip directory subtree
-exec CMD {} ; — run CMD with full path
-execdir CMD {} ; — run CMD in file's directory with ./basename
-quit — exit immediately
-true — always true
-false — always false
Operators:
( EXPR ) — grouping ! EXPR, -not EXPR — negation EXPR -a EXPR, EXPR -and EXPR, EXPR EXPR — conjunction (implicit) EXPR -o EXPR, EXPR -or EXPR — disjunction
Blocked predicates (sandbox safety):
-delete, -ok, -okdir — deletion/interactive -fls, -fprint, -fprint0, -fprintf — file writes -regex, -iregex — ReDoS risk
Exit codes:
0 All paths searched successfully. 1 At least one error occurred.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = builtins.Command{ Name: "find", Description: "search for files in a directory hierarchy", MakeFlags: builtins.NoFlags(run), }
Cmd is the find builtin command descriptor.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.