Bash Globstar `**`

In recent versions of bash, the ** expression can be used to indicate matches for a particular directory while including sub-directories. This can be a big help when dealing with some messy filesystem structures.

1
2
shopt -s globstar
data/$year/**/*.nc

This example would match .nc files in $year and the folders below $year. Depending on the shell configuration or if running within a script, shopt -s globstar may be necessary to enable the capability.