Well, if you are using the find command, pipe it through egrep, and return just the ones that you want. I.e.
Code:
find . -name "*php" | egrep -v 'directory1|directory2|...' | wc -l
However, if you are using the script I provided (you didn't specify, so we'll cover all of the bases here), I modified the script to take the base directory as an argument if supplied (if not, it will prompt). In which case it would be
Code:
script_name.sh /directory_path | egrep -v 'directory1|directory2|...'
My new script is below ...
Code:
#!/bin/bash
# Standard Errors
E_SUCCESS=0 # Return if the script runs successfully
E_WRONGARGS=65 # Return if more than 1 argument is given
#Functions
F_dirs()
{
if [ `ls -l ${1}| egrep '^d' | wc -l` -eq 0 ]
then
F_count ${1}
else
for j in `ls -l ${1} | egrep '^d' | tr -s [:blank:] ' ' | cut -d' ' -f9`
do
F_dirs ${1}/${j}
done
fi
}
F_count()
{
echo "${1} - php: `ls -l ${1}/*php 2> /dev/null | wc -l`"
echo "${1} - html: `ls -l ${1}/*html 2> /dev/null | wc -l`"
}
# Main Code
case "$#" in
0)
echo -n "Enter the base directory: "
read base_dir;;
1)
base_dir=${1};;
*)
echo " Please use no arguments, or the base directory as the soul argument."
exit $E_WRONGARGS;;
esac
for i in `ls -l | egrep '^d' | tr -s [:blank:] ' ' | cut -d' ' -f9`
do
F_dirs ${i}
done
exit $E_SUCCESS