I am trying to count the number of file in each directory/subdirectory, add them together and get a total which I can then compare to another directory:
#!/bin/bash
echo "Checking directories for proper extensions"
for LOOP in 1 2 3 4;
do
if [[ $LOOP -eq 1 ]]; then
find ./content/documents -type f ! \( -name \*.txt -o -name \*.doc -o -name \*.docx \)
count1=$(find ./content/documenets -type f) | wc -l
#count number of files in directory and add to counter
elif [[ $LOOP -eq 2 ]]; then
find ./content/media -type f ! -name \*.gif
count2=$(find ./content/media -type f) | wc -l
#count number of files in directory and add to counter
elif [[ $LOOP -eq 3 ]]; then
find ./content/pictures -type f ! \( -name \*.jpg -o -name \*.jpeg \)
count3=$(find ./content/pictures -type f) | wc -l
#count number of files in directory and add to counter
else
count4=$(find /home/dlett/content/other -type f) | wc -l
#count number of files in directory and add to counter
fi
#list the files in each subdirectory in catalog and put into an array
#count the number of items in the array
#compare number of item in each array
#if the number of item in each array doesn't equal
#then print and error message
content_Count=$(( count1+count2+count3+count4 ))
echo $content_Count
done