Date: 2007nov28
OS: Linux, Unix
Keywords: glob
Q. Linux: How do I find files in a bunch of subfolders?
A. For years I composed "find" commands to do this sort of
thing. For example:
cd /etc
find . -name \*.conf
But check out this way of doing it:
cd /etc
ls */*.conf
More compact and easier to understand.
For some reason I had never thought of using multiple stars
in one command. Notice that bash is smart enough to evaulate
the second star in each subfolder!
The find command will list .conf files in the /etc folder.
While the ls doesn't. Perhaps this is what you want.
Of course, find will look in a unlimited number of subfolders
(unless you use -maxdepth) and the ls only looks down one.
But sometimes is is exactly what you want.