Posted to tcl by cgm at Mon Jan 22 09:20:05 GMT 2024view raw
- proc get_filesnames {} {
- set namelist {}
- add_filenames . [file_pattern] namelist
- return $namelist
- }
- proc add_filenames {dir fpat listVar} {
- upvar $listVar namelist
- foreach f [lsort [glob -directory $dir -nocomplain -type {f r} -- $fpat]] {
- lappend namelist $f
- }
- foreach d [lsort [glob -directory $dir -nocomplain -type {d r} -- *]] {
- add_filenames $d $fpat namelist
- }
- }