It isn't hard but I thought I'd post the tip here anyhow. Using the "ls" command "wc" command you can count the number of files in a directory:

Code:
# ls <dir> | wc -l
Example:
Code:
# ls / | wc -l
  23
# ls /home/tor/*.txt | wc -1
  2
You can assign this to a variable in bash and use it in if statments:

Code:
SOMEVAR=`ls <dir> | wc -l`
And now you can test SOMEVAR for 0 (no files) or files.