Is there a way to use shell globbing to identify nested directories?
so if I have dir/dir1/dir2/dir3/dir4/dir5/.. and I have files under all of them, what is the equivalent globbing pattern to match all files under all directories, similar to - for example - ls -R
In Bash 4, with shopt -s globstar
, and zsh you can use **/*
which will include everything except hidden files. You can do shopt -s dotglob
in Bash 4 or setopt dotglob
in zsh to cause hidden files to be included.
In ksh, set -o globstar
enables it. I don't think there's a way to include dot files implicitly, but I think **/{.[^.],}*
works.