proc ::nxLib::GetDirStats {realPath varName {ignoreList ""} {firstCall 1}} { upvar $varName stats if {$firstCall} { array set stats [list DirCount 0 FileCount 0 TotalSize 0] } if {[file isdirectory $realPath]} { incr stats(DirCount) set listing [glob -nocomplain -directory $realPath "*"] } elseif {[file isfile $realPath]} { set listing [list $realPath] } else {return} foreach element $listing { if {[file readable $element] && ![ListMatchI $ignoreList [file tail $element]]} { if {[file isdirectory $element]} { GetDirStats $element stats $ignoreList 0 } else { incr stats(FileCount) set stats(TotalSize) [expr {wide($stats(TotalSize)) + wide([file size $element])}] } } } return }