How can I search through directories starting with a certain letter with the Linux find command.
For example I want to search all directories starting with the letter a
for a file or directory starting with b
.
command linefindlinux
How can I search through directories starting with a certain letter with the Linux find command.
For example I want to search all directories starting with the letter a
for a file or directory starting with b
.
Best Answer
Try a find in a find:
Starting at the current directory (
.
), find will look for all directories starting with the letter a recursively. For each directory it finds, it will look inside it for a file named b.If you only want it to look in the folders starting with a, and no directories in those a* folders, use maxdepth:
to get rid of errors: