Linux – How to count all subfolders in an directory

countdirectoryfindlinux

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

Best Answer

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

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