count files in a folder: ls -1 | wc -l
When You need to change the root folder of the website transparently with no touching actual scripts, then this one would help.
tar -zcvf photos.tar.gz photos/