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
If you want to use regular expressions, then try:
ls -c | grep "^d" | wc -l