Posted to tcl by iobates at Fri Jul 31 18:23:22 GMT 2026view raw
-
- proc rglob { dirpath patterns {exclude_pats {}} } {
- set rlist {}
- set f_exclude [glob -nocomplain -types f -directory ${dirpath} {*}${exclude_pats}]
- set d_exclude [glob -nocomplain -types d -directory ${dirpath} {*}${exclude_pats}]
- foreach fpath [glob -nocomplain -types f -directory ${dirpath} {*}${patterns}] {
- if { ${fpath} ni ${f_exclude} } {
- lappend rlist ${fpath}
- }
- }
- foreach dir [glob -nocomplain -types d -directory ${dirpath} *] {
- if { ${dir} ni ${d_exclude} } {
- lappend rlist {*}[rglob ${dir} ${patterns} ${exclude_pats}]
- }
- }
- return ${rlist}
- }
-
Add a comment