Linux find command-path, linuxfind-path
From: http://www.cnblogs.com/hopeworld/archive/2011/04/08/2009252.html
In Windows, you can search for files in some paths or not in some paths, the following uses the find command in Linux and Its-path-prune parameter to check how this function is implemented in Linux.
If you search for files in the current directory, and the current directory contains many files and directories (Multi-Level Directories), including dir0, dir1, and dir2... directory and dir00, dir01... dir10, dir11....
1. Search for all txt suffix files in the current directory
Find./-name *. txt
2. Search for txt suffix files under the dir0 directory and subdirectory in the current directory
Find./-path './dir0 *'-name *. txt
3. Search for the txt suffix file in the dir0 sub-directory dir00 and its sub-directories in the current directory.
Find./-path '* dir00 *'-name *. txt
4. Search for txt suffix files in directories other than dir0 and subdirectories
Find./-path './dir0 *'-a-prune-o-name *. txt-print
Note:-a should be the abbreviation of and, which means the logical operator 'or' (&);-o should be the abbreviation of or, it indicates the logical operator 'and' (|).-not indicates non.
The command line means: If the directory dir0 exists (that is, the left side of-a is true), evaluate the value of-prune and-prune returns the true value, 'and' logical expressions are true (that is,-path '. /dir0 * '-a-prune is true), the find command will find and print the txt suffix file in a directory other than this directory; if the directory dir0 does not exist (that is, the left side of-a is false), do not ask the value-prune. If the logical expressions 'and' are false, search for all txt suffix files in the current directory.
5. Search for txt suffix files in directories other than dir0, dir1, and subdirectories
Find./\ (-path './dir0 *'-o-path'./dir1 * '\)-a-prune-o-name *. txt-print
Note: parentheses () indicate the combination of expressions. That is, it indicates that shell does not give a special explanation for the subsequent characters, but leaves it to the find command to explain its meaning. Since the command line cannot directly use parentheses, you need to use the backslash '\' to compress (that is, the '\' to enable the command line to recognize the parentheses ). Note that spaces are required on both sides.
6. Search for txt suffix files under dir0, dir1, and subdirectories
Find./\ (-path './dir0 *'-o-path'./dir1 * '\)-a-name *. txt-print
7. Search for txt suffix files in all directories named dir_general
Find./-path '*/dir_general/*'-name *. txt-print