Im trying to use the find command to recursively search a directory tree and return all results with a directory matching a given name.
find . -type d -name '<NAME>'
I get a list of paths returned which are printed into a log file. I want to be able to omit any results which contain a file called omit.txt within a parent directory.
I have been trying to do it with the following
find . -type d -name '<NAME>' \( ! -wholename "*omit.txt*" -prune \)
I am trying to use the prune command to omit results containing the file, but I think this may only work with directories. Any help would be greatly appreciated. I am trying to do this in just one command and maintain the output file as much as possible -