find a word from all files excluding 1 directory

You can’t ignore initial search in all directories, but you can remove the files from specified directory after the first step.

find .  -type f -exec grep  -l "port" {} \;| grep -v <dir_name_to exclude>

Leave a Comment