These edits are based upon very helpful comments of @rubo77 and @Anthon. ThisThis is done to find both visible and hidden directories within the present working directory, excluding the root directory:
to just loop through directories:
find -path './*' -prune -type d
to include symlinks in the result:
find -L -path './*' -prune -type d
to do something to each directory (excluding symlinks):
find -path './*' -prune -type d -print0 | xargs -0 <cmds>
to exclude hidden directories:
find -path './[^.]*' -prune -type d
to execute multiple commands on the returned values (a very contrived example):
find -path './[^.]*' -prune -type d -print0 | xargs -0 -I '{}' sh -c \
"printf 'first: %-40s' '{}'; printf 'second: %s\n' '{}'"
instead of 'sh -c' can also use 'bash -c', etc.