LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   directory and subdirectories (http://www.linuxquestions.org/questions/linux-newbie-8/directory-and-subdirectories-924611/)

congos 01-19-2012 08: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 08:48 AM

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

I hope that helps you.

thesnow 01-19-2012 08:52 AM

Code:

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 01:49 AM.