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
Best way to do it:
ls -la | grep -v total | wc -l
This gives you the perfect count.