Check out example codes for "loop through directories bash". It will help you in understanding the concepts better.

Code Example 1

#loops only through directories
for d in */ ; do
    echo "$d"
done

Learn ReactJs, React Native from akashmittal.com