find directories not contain specific file 1

find directories not contain specific file

find /path/to/search -type d \! -exec test -e '{}/file_no_hereName' \; -print

find . -type d '!' -exec test -e "{}/your_file" ';' -print

https://unix.stackexchange.com/questions/158238/find-directories-not-containing-a-file

Here is what the above code is Doing:
1. find . -type d -print
– find all directories in the current directory and print them
2. ! -exec test -e “{}/your_file” ‘;’
– for each directory, execute the command test -e “{}/your_file”
– if the command returns true, then exclude the directory from the results
– if the command returns false, then include the directory in the results

Similar Posts