This should do the job:
"INCORRECT" in text inside of files inside of folders and files within given folder:
SEARCH_DIR="/var/log" for i in $(find $SEARCH_DIR -maxdepth 1 -mindepth 1); do DIR_CHECK=$(grep INCORRECT $i) [[ "$DIR_CHECK" =~ "INCORRECT" ]] \ && echo -e "\e[00;31m$i\e[00m" \ || echo -e "\e[00;32m$i\e[00m" done
"INCORRECT in text inside of files inside of folders in the given folder":
SEARCH_DIR="/var/log" for i in $(find $SEARCH_DIR -maxdepth 1 -mindepth 1 -type d); do DIR_CHECK=$(grep INCORRECT $i) [[ "$DIR_CHECK" =~ "INCORRECT" ]] \ && echo -e "\e[00;31m$i\e[00m" \ || echo -e "\e[00;32m$i\e[00m" done
"INCORRECT" in name of folders and files in given folder:
SEARCH_DIR="/var/log" for i in $(find $SEARCH_DIR -maxdepth 1 -mindepth 1); do DIR_CHECK=$(echo $i | grep INCORRECT) [[ "$DIR_CHECK" =~ "INCORRECT" ]] \ && echo -e "\e[00;31m$i\e[00m" \ || echo -e "\e[00;32m$i\e[00m" done
"INCORRECT" in name of folders in given folders:
SEARCH_DIR="/var/log" for i in $(find $SEARCH_DIR -maxdepth 1 -mindepth 1 -type d); do DIR_CHECK=$(echo $i | grep INCORRECT) [[ "$DIR_CHECK" =~ "INCORRECT" ]] \ && echo -e "\e[00;31m$i\e[00m" \ || echo -e "\e[00;32m$i\e[00m" done
lshad to read the file first, which slows down directory listing.