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 find discovers 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. A double dash - can also be used to signal that any remaining arguments are not options (though ensuring that all start points begin with either `./' or `/' is generally safer if you use wildcards in the list of start points). The five `real' options -H, -L, -P, -D and -O 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. 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. That argument and any following arguments are taken to be the expression describing what is to be searched for. 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 `-', or the argument `(' or `!'. The -H, -L and -P options control the treatment of symbolic links. That document also includes a lot more detail and discussion than this manual page, so you may find it a more useful source of information. If you are using find in an environment where security is important (for example if you are using it to search directories that are writable by other users), you should read the `Security Considerations' chapter of the findutils documentation, which is called Finding Files and comes with findutils. If no starting-point is specified, `.' is assumed. GNU find searches the directory tree rooted at each given starting-point by evaluating the given expression from left to right, according to the rules of precedence (see section 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. This manual page documents the GNU version of find. Find files modified in the last 7 days, and delete them: find root_path -mtime -7 -deleteįind Description.Find files matching a given size range: find root_path -size +500k -size -10M.Find files matching a given pattern, excluding specific paths: find root_path -name ' *.py' -not -path ' */site-packages/*'.Find files matching a path pattern: find root_path -path ' **/lib/**/*.ext'.Find directories matching a given name, in case-insensitive mode: find root_path -type d -iname *lib*.Find files by matching multiple patterns: find root_path -name ' *pattern_1*' -or -name ' *pattern_2*'.Find files by extension: find root_path -name ' *.ext'.Find - search for files in a directory hierarchy Examples (TL DR)
0 Comments
Leave a Reply. |