http://blog.csdn.net/pipisorry/article/details/39831419
Problem:
Find command found in Linux does not contain some directories
The Find command ignores methods of one or more subdirectories
When searching with Find in Linux, it is sometimes necessary to ignore some directories that do not look for, you can use the-prune parameter to filter, the path parameter to ignore must follow the path of the search, otherwise the parameter will not work.
eg
[email protected]:/tmp1#find./-type f #/tmp1 All files in all folders./file./1/1.cpp./2/2.cpp[email Protected]:/tmp1#find./- Path./1-prune-o-type f-print #/tmp1 find files but ignore files in Folder/1./file./2/2.cpp[email protected]:/tmp1#find./\ (-path./1-o -path./2 \)-prune-o-type f-print #/tmp1 to find files while ignoring files in folder/1/2./file
Mans Find
-path pattern File Name matches shell pattern pattern. The metacharacters does not treat '/' or '. ' Specially; So, for example, find. -path "./sr*sc" would print a 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 P Rint the names of the other files found, does 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 in the command line. It would only do sense to use a absolute path name here if the relevant start point was also an absolute Path. This means That this command would never match Anything:find Bar-path/foo/bar/myfile-print T He predicate-path is also supported by HP-UX find and would be in a forthcoming version of the POSIX Standar D....
Parameter-wholename can also be used, but it is not recommended
-wholename pattern See-path. This alternative was less portable than-path.
from:http://blog.csdn.net/pipisorry/article/details/39831419
The Find command in Linux is detailed