4 echo -n "files in '$dir':"
5 /bin/ls -1fR "$dir" | grep -v "^$" | grep -v "^\.$" | grep -v "^\.\.$" | grep -v ".*:$" | wc -l
7 # patterns that remove files from being counted, above:
9 # ^$ -- all blank lines
10 # ^\.$ -- all lines with just a dot (current directory)
11 # ^\.\.$ -- all lines with just two dots (parent directory)
12 # .*:$ -- all lines that end with a colon (directory heading from recursive ls)