find directories that does NOT contain a file


Let say you have multiple directories, and would like to show those directory that DO NOT contain a specific file:

For example: searching a cookbook that does not has a "metadata.rb" file in it's directory.

find ./ -maxdepth 1 -type d '!' -exec test -e "{}/metadata.rb" ';' -print

No comments: