

If the named file is in fact a symbolic link, and the -P option is in effect (or if neither -H nor -L were specified), the information used for the comparison will be taken from the properties of the symbolic link. In each case, the file specified on the command line will have been examined and some of its properties will have been saved. Specifically, there are a number of tests that compare files listed on the command line against a file we are currently considering. These options also affect how those arguments are processed. GNU find frequently stats files during the processing of the command line itself, before any searching has begun. Since it is the default, the -P option should be considered to be in effect unless either -H or -L is specified. If more than one of -H, -L and -P is specified, each overrides the others the last one appearing on the command line takes effect. If -H is in effect and one of the paths specified on the command line is a symbolic link to a directory, the contents of that directory will be examined (though of course -maxdepth 0 would prevent this). The information about the link itself is used as a fallback if the file pointed to by the symbolic link cannot be examined. For that situation, the information used is taken from whatever the link points to (that is, the link is followed).

The only exception to this behaviour is when a file specified on the command line is a symbolic link, and the link can be resolved. When find examines or prints information about files, the information used shall be taken from the properties of the symbolic link itself. Using -L causes the -lname and -ilname predicates always to return false.ĭo not follow symbolic links, except while processing the command line arguments. When the -L option is in effect, the -type predicate will always match against the type of the file that a symbolic link points to rather than the link itself (unless the symbolic link is broken). If -L is in effect and finddiscovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched. If you later use the -P option, -noleaf will still be in effect. When find 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 find is unable to examine the file to which the link points). 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.įollow symbolic links. The three 'real' options -H, -L and -P must appear before the first path name, if at all. These options control the behaviour of find but are specified immediately after the last path name.
FIND ANY FILE UNIX MANUAL
This manual page talks about 'options' within the expression list. If no expression is given, the expression '-print' is used (but you should probably consider using '-print0' instead, anyway). If no paths are given, the current directory is used. Command-line arguments following these are taken to be names of files or directories to be examined, up to the first argument that begins with and of the characters: - ( ), ! That argument and any following arguments are taken to be the expression describing what is to be searched for. The -H, -L and -P options control the treatment of symbolic links. GNU find searches the directory tree rooted at each given file name by evaluating the given expression from left to right, according to the rules of precedence ( see Operators), until the outcome is known (the left hand side is false for AND operations, true for OR), at which point find moves on to the next file name. Search a folder hierarchy for filename(s) that meet a desiredĬriteria: Name, Size, File Type - see examples.
