shell - How can I glob all nested files with subdirectory exceptions -
i attempting use shell globbing grab nested matchin folders, except ones in particular directory
|__foo | |__foo.txt |__bar | |__bar.txt |__baz | |__baz.txt
can glob return
bar/bar.txt
, baz/baz.txt
the folders include vary, need explicitly exclude foo directory. possible?
pseudo code
something [**|!foo]/*.txt
in bash, can use extended globbing
for example
$ find . ./bar ./bar/bar.txt ./biz ./biz/biz.txt ./foo ./foo/foo.txt # turn on extended globbing $ shopt -s extglob # match files not in foo $ ls !(foo)/* bar/bar.txt biz/biz.txt # match files in neither foo nor bar $ ls !(foo|bar)/* biz/biz.txt
Comments
Post a Comment