[a_]* matches names that start with either of the characters
_. The pattern
*[.csv] matches names that end with one of the characters
v. To match names that start with
-name 'a_*'. To match names that end with
find ../ -name 'a_*' -a -name '*.csv' or equivalently
find ../ -name 'a_*.csv' matches files whose name starts with
a_ and ends with
.csv. This does not filter on the directories traversed to reach the file.
If the files are in subdirectories of the parent directory (e.g.
../a_foo/wibble.csv), you don't need
find command is only useful to search directory trees recursively. You can use
If the files can be in subdirectories below the
a_* directories (e.g.
../a_foo/bar/wibble.csv but not
../qux/a_foo/wibble.csv), then call
find and tell it to search the
find ../a_* -name '*.csv'
Alternatively, instead of using
find, you can use the
** wildcard to search in subdirectories recursively. In ksh93, you need to enable this pattern with
set -o globstar first. In bash, you need to enable this pattern with
shopt -s globstar first. In zsh, this pattern is enabled by default. Other shells such as plain sh don't have
a_* directories can themselves be at any depth below the parent directory, you can either use
find -path or
find .. -path '*/a_*/*.csv'