Pavel
Pavel

Reputation: 5353

How to count recursively and display the number of all sub-directories for a working directory?

Hey guys. Just like in the title - I'm having some problems doing it. Basically, I want to create an alias in my enviromental file that would count recursively and display the number of all sub-directories of a working directory. Could someone provide me with adequate group of shell commands? I'm using Korn shell. Thank you in advance!

Upvotes: 0

Views: 1748

Answers (1)

Zsolt Botykai
Zsolt Botykai

Reputation: 51643

alias dircount="find . -type d 2> /dev/null | wc -l"

should work. But don't forget, that it skips directories for which you doesn't have access rights.

HTH

Upvotes: 2

Related Questions