Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Count all files and subfolder files within a folder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Count all files and subfolder files within a folder
Authored by: kenahoo on Nov 10, '04 07:23:34PM

An easier and faster way is to use 'find':

#!/bin/sh
# Specify the root of the tree as first parameter.
echo "Total Apps: " `find $1 -name '*.app' | wc -l`
echo "Total Files: " `find $1 -not -type d | wc -l`
echo "Total Folders: " `find $1 -type d | wc -l`

-Ken



[ Reply to This | # ]