Somewhat like the UNIX command '''du''' - returns number of blocks (either 512 byte or 1024 byte sized blocks) within a directory hierarchy proc du { { switch -k } { dir . } } { if { ! [ regexp -nocase -- {^-+[bkm]$} $switch ] } { set dir $switch set switch -k } set switch [ string tolower $switch ] set -b 1 set -k 1024 set -m [ expr 1024*1024 ] set result [ list ] if { ! [ file isdirectory $dir ] } { set ary($dir,bytes) [ file size $dir ] set globpats [ list ] } else { set globpats $dir/* } while { [ llength $globpats ] } { foreach globpat $globpats { set cwd [ string trim $globpat */ ] set ary($cwd,bytes) 0 set files [ glob -nocomplain $globpat ] set globpats [ list ] foreach file $files { if { ! [ catch { file readlink $file } ] } { continue } if { [ file isdirectory $file ] } { lappend globpats $file/* } else { incr ary($cwd,bytes) [ file size $file ] } } } } set dirs [ array names ary ] if { [ llength $dirs ] > 1 } { foreach dir $dirs { set dir [ lindex [ split $dir , ] 0 ] foreach Dir $dirs { set Dir [ lindex [ split $Dir , ] 0 ] if { [ string match $dir/* $Dir ] } { incr ary($dir,bytes) $ary($Dir,bytes) } } } } foreach dir $dirs { set name [ lindex [ split $dir , ] 0 ] set size [ expr { $ary($dir) / [ set $switch ] } ] lappend retval [ list $name $size ] } return $retval } ---- anyone that cares to may fill in the missing command line switches... ----