-   Linux - Newbie (
-   -   directory and subdirectories (

congos 01-19-2012 09:46 AM

directory and subdirectories
im trying to write a script that finds the number of sub directories in a directory specified

kishore_ari 01-19-2012 09:48 AM

find <specified directory> -type d|wc -l

I hope that helps you.

thesnow 01-19-2012 09:52 AM


find /path/to/directory/* -type d | wc -l
This will exclude the directory itself, if you also want to count that remove the "*"
It will also not follow symlinks, if you want it to do that, add the -L option after "find"

All times are GMT -5. The time now is 09:30 AM.