I recently needed to count the number of files, not including directories, within a given directory. Additionally, I wanted to count recursively.
On FreeBSD or Linux, you can do this with the following commands:
$ find /path/to/dir -type f | wc -l
Pretty handy!
-Chris
This entry was posted on Sunday, October 14th, 2007 at 8:33 pm and is filed under Tech :: Handy Commands, Tech :: Linux, Tech :: Mac. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Name (required)
Mail (will not be published) (required)
Website
Anti-spam word: (Required)* To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.