How to count all subfolders in an directory?

How can I count how many folders (including subfolders) I have under an specific folder?


Use find to select the directories and wc to count them.

find <directory> -mindepth 1 -type d | wc -l