Recursively search directories for a filename, stop descending if found
0
votes
2
answers
620
views
I have a directory-tree which contains files with the same name, e.g.:
a/file
a/...
a/b/file
x/a/file
x/a/...
x/b/file
I'm trying to use find
(with -exec
and -prune
) to get all paths where file
occurs first when recursively searching the tree. My example would return:
a/file
x/a/file
x/b/file
It does not return a/b/file
because a file called file
is already in a/
.
How can I achieve that with Bash?
Asked by Patrick B.
(185 rep)
Feb 3, 2020, 06:08 PM
Last activity: Nov 19, 2024, 10:20 AM
Last activity: Nov 19, 2024, 10:20 AM