LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Simple Bash cmd Help (https://www.linuxquestions.org/questions/linux-newbie-8/simple-bash-cmd-help-861145/)

sublime188 02-07-2011 05:12 AM

Simple Bash cmd Help
 
Hello everyone,
Yes, I am a noob and I am trying to display a count of the number of subdirectories in a directory.

I have been able to use find -type d to list directories and subdirs but I want a numerical value of dirs and subdirs.

I know ls -l gives a count but when I try ls -l -d all it shows is "." I also have tried a combination with the -R option but nothing seems to be working for me.

Please forgive my ignorance but I am working on a script for class and this is the first step. Any help will be appreciated.

druuna 02-07-2011 05:29 AM

Hi,

Are you looking for this:
Code:

find . -type d | wc -l
Hope this helps

sublime188 02-07-2011 05:46 AM

Thanks for the quick reply druuna. That was exactly what I was looking for.

druuna 02-07-2011 05:49 AM

You're welcome :)


All times are GMT -5. The time now is 05:50 PM.