file counter

Directory FileCount

|

I have close to 3000 images in a folder and needed to know exactly how many for a stupid bet I made. I dont feel like counting them! there must be something in the linux world to make this easier…. well there is. simple extension of the ls command.

my directory is called images but I’m sure contains no images whatsoever. *cough* so lets get the basics :

ls -1 images | wc -l

what if you wanted to not count sub directories or symlinks?

find images -maxdepth 1 -type f | wc -l

want to add symlinks?

find images -maxdepth 1 -type f -follow | wc -l

so yeah the basics should be done 🙂

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *