How can I recursively find all files in current and subfolders based on wildcard matching? How can I recursively find all files in current and subfolders based on wildcard matching? shell shell

How can I recursively find all files in current and subfolders based on wildcard matching?


Use find for that:

find . -name "foo*"

find needs a starting point, and the . (dot) points to the current directory.


Piping find into grep is often more convenient; it gives you the full power of regular expressions for arbitrary wildcard matching.

For example, to find all files with case insensitive string "foo" in the filename:

~$ find . -print | grep -i foo


find will find all files that match a pattern:

find . -name "*foo"

However, if you want a picture:

tree -P "*foo"

Hope this helps!