search for files in a directory hierarchy |
find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression] |
-not expr Same as ! expr, but not POSIX compliant. |
-path pattern File name matches shell pattern pattern. The metacharacters do not treat `/' or `.' specially; so, 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 Note that the pattern match test applies to the whole file name, starting from one of the start points named on the command line. It would only make sense to use an absolute path name here if the relevant start point is also an absolute path. This means that this command will never match anything: find bar -path /foo/bar/myfile -print The predicate -path is also supported by HP-UX find and will be in a forthcoming version of the POSIX standard. |
-P Never follow symbolic links. This is the default behaviour. When find examines or prints information a file, and the file is a symbolic link, the information used shall be taken from the properties of the symbolic link itself. |
-D debugoptions Print diagnostic information; this can be helpful to diagnose problems with why find is not doing what you want. The list of debug options should be comma separated. Compatibility of the debug options is not guaranteed between releases of findutils. For a complete list of valid debug options, see the output of find -D help. Valid debug options include help Explain the debugging options tree Show the expression tree in its original and optimised form. stat Print messages as files are examined with the stat and lstat system calls. The find program tries to minimise such calls. opt Prints diagnostic information relating to the optimisation of the expression tree; see the -O option. rates Prints a summary indicating how often each predicate succeeded or failed. |