linux - [Solved-7 Solutions] How to recursively find all files in current and subfolders based on wildcard matching ? - ubuntu - red hat - debian - linux server - linux pc
Linux - Problem :
How to recursively find all files in current and subfolders based on wildcard matching ?
Linux - Solution 1:
Use find for that:
find needs a starting point, and the . (dot) points to the current directory.
Linux - Solution 2:
To find all files with case insensitive string "wikitechy" in the filename:
Linux - Solution 3:
find will find all files that match a pattern:
However, if you want a picture:
Linux - Solution 5:
- In a few cases, -L parameter to handle symbolic directory links.
- By default symbolic links are ignored.
- In those cases it was quite confusing as I would change directory to a sub-directory and see the file matching the pattern but find would not return the filename. Using -L solves that issue.
- The symbolic link options for find are -P -L -H
Linux - Solution 6:
If you shell supports extended globbing (enable it by: shopt -s globstar), you can use:
To find any files or folders recursively. This is supported by Bash, zsh and similar shells.
Linux - Solution 7:
In the wildcard-match you can provide the string you wish to match e.g. *.c (for all c files)