In Windows, you can find files in some paths, or you can set the file to not be found in some paths, and use the Find command in Linux with its-path-prune parameter to see how this function is implemented in Linux.
If the file is located in the current directory, and the current directory has a lot of files and directories (multi-level directory), including DIR0, Dir1 and Dir2 ... and other directories and dir00, Dir01...dir10, Dir11 ... such as subdirectories.
1. Find all txt suffix files in the current directory
Find./-name *.txt
2. Find the txt suffix file under the Dir0 directory and subdirectories under the current directory
Find./-path './dir0* '-name *.txt
3. Find the TXT suffix file under the subdirectory dir00 and its subdirectories under the DIR0 directory under the current directory
Find./-path ' *dir00* '-name *.txt
4. Find the txt suffix file in a directory other than Dir0 and subdirectories
Find./-path './dir0* '-a-prune-o-name *.txt-print
Description:-A should be an abbreviation for and, meaning logical operator ' or ' (&&); -O should be an abbreviation of OR, meaning the logical operator ' with ' (| |),-not represents non.
The command line means: If the directory dir0 exists (that is,-a left is true), then the-prune value is evaluated,-prune returns True, ' and ' the logical expression is true (that is,-path './dir0* '-a-prune is true), The Find command will look for the txt suffix file in a directory other than this directory and print it out, if the directory dir0 does not exist (that is, a left is false), then no value-prune, ' and ' logical expression is false, the current directory to find all txt suffix files.
5. Find the txt suffix file in a directory other than Dir0, Dir1, and subdirectories
Find./\ (-path './dir0* '-o-path './dir1* ')-a-prune-o-name *.txt-print
Note: parentheses () denote the combination of expressions. This instructs the shell not to give a special explanation of the characters that follow, leaving the Find command to explain its meaning. Because the command line cannot use parentheses directly, you need to use a backslash ' \ ' to make a change (that is, the ' \ ' transpose character makes the command line aware of the parentheses). Also note that ' \ (', ' \ ') ' requires spaces on both sides.
6. Find the txt suffix file in dir0, Dir1, and sub-directories
Find./\ (-path './dir0* '-o-path './dir1* ')-a-name *.txt-print
+1. Find the txt suffix file in all directories named Dir_general
Find./-path ' */dir_general/* '-name *.txt-print
Reference
Http://blog.csdn.net/unbutun/article/details/4703161