Posted to tcl by iobates at Fri Jul 31 18:23:22 GMT 2026view raw

  1.  
  2. proc rglob { dirpath patterns {exclude_pats {}} } {
  3. set rlist {}
  4. set f_exclude [glob -nocomplain -types f -directory ${dirpath} {*}${exclude_pats}]
  5. set d_exclude [glob -nocomplain -types d -directory ${dirpath} {*}${exclude_pats}]
  6. foreach fpath [glob -nocomplain -types f -directory ${dirpath} {*}${patterns}] {
  7. if { ${fpath} ni ${f_exclude} } {
  8. lappend rlist ${fpath}
  9. }
  10. }
  11. foreach dir [glob -nocomplain -types d -directory ${dirpath} *] {
  12. if { ${dir} ni ${d_exclude} } {
  13. lappend rlist {*}[rglob ${dir} ${patterns} ${exclude_pats}]
  14. }
  15. }
  16. return ${rlist}
  17. }
  18.  

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week