proc findCurDirs { path pattern } { puts "hehe" global matchDirs set curDirs "" catch {set curDirs [glob -type d -directory $path *]} if { [llength $curDirs] != 0 } { foreach dir $curDirs { puts $dir if { [regexp $pattern $dir] } { lappend matchDirs $dir } findCurDirs $dir $pattern } } }