I want to find all files in all subdirectories which has a name ExampleDir
eg.
+ ParentDirA
+ ChildDirA
- file1.txt
+ ExampleDir
- file2.txt
+ ParentDirB
+ ChildDirB
- file3.csv
+ ExampleDir
- file4.csv
Executing command should return: file2.txt and file4.csv
I have tried the following:
find . -type d -name "ExampleDir" | xargs find -type f
find . -type d -name "ExampleDir" -exec find -type f {} \;
find . -type d -name "ExampleDir" -exec find -type f {} +
They all return:
find: paths must precede expression
If I were to go down this route (which I think is logical) I would have to find out how to pipe the path to the find command.
Is there a better way?