Skip to main content
3 of 3
deleted 500 characters in body
Kusalananda
  • 356.6k
  • 42
  • 739
  • 1.1k

A simple shell loop solution would be to do

for pathname in Test/???/; do
    printf '%s\n' "$( basename "$pathname" )"
done

This would print each subdirectory name that matches the given pattern (or names of symbolic links to subdirectories).

If you want to do anything other than listing the names, then you would do something like

for pathname in Test/???/; do
    # some code using "$pathname" here
done

I.e., you would not first generate the list and then iterate over it.

Kusalananda
  • 356.6k
  • 42
  • 739
  • 1.1k