Is there a bash equivalent to zsh's file-type globbing?

bash, glob

Solution

you can try

ls -ltrd */ #match directories using -d and the slash "/"

or

echo */

or

for dir in */
do
  ...
done

If you need to do it recursive, and you have Bash 4+

$ shopt -s globstar
$ for dir in **/*/; do echo $dir; done

Problem

In zsh you can qualify globs with file type assertions e.g. `*(/)` matches only directories, `*(.)` only normal files, is there a way to do the same thing in bash without resorting to find?

Original source