How do you find all files with a particular parent directory in the linux command terminal?
I know to find all files using find
like so:
find . -name filename.extension
But is it possible to find all filename.extension
files with the parent directory of foldername
?
I have tried the following but this does not work:
find . -name foldername/filename.extension
And I cannot find any example of how to do this.
So some example results I would expect are as so:
./example/project/website/foldername/filename.extension
./folder/demo/foldername/filename.extension
./more/files/foldername/filename.extension
./business/assets/foldername/filename.extension
./steven/foldername/filename.extension
Is there anyway to do this?
Best Answer
Use
-path
switch with find