How to count the number of folders in a specific directory. I am using the following command, but it always provides an extra one.
find /directory/ -maxdept
Get a count of only the directories in the current directory
echo */ | wc
you will get out put like 1 309 4594
1 309 4594
2nd digit represents no. of directories.
2nd digit
or
tree -L 1 | tail -1