Glob expanding to all files in current directory recursively
Oftentimes you want to process all files in a deep filestructure recursively.
In bash
this can be accomplished with the following glob: {,**/}*.ext
To see it in action, try with ls
$ ls -1 {,**/}*.*
example/ignoreme.txt
test.t
I picked this up from a marvellous response on StackOverflow.
If you like me attempt to do secure shell scripting, do note that this does not work with: set -f
Disable filename expansion (globbing) upon seeing *, ?, etc.
This took me some time to figure out.
I use the globbing trick when processing a deep structure of XML files using xmllint
:
$ xmllint --noout --schema my.xsd xml/{,**/}*.xml
Another explanation is available here from unix.stackexchange.com.