set str [glob *]
set n_file 0
set n_directory 0
set flem()
set len [llength $str]
puts [format "C:\Tcl\bin 的目录" ]
for { set i 0 } { $i<$len } {incr i 1} {
set temp [lindex $str $i]
set date [file atime $temp]
if {[file isfile $temp]==1} {
set n_file [expr $n_file + 1]
}
if {[file isdirectory $temp]==1} {
set n_directory [expr $n_directory + 1]
}
set date [clock format $date -format "%Y年%m月%d %H:%M:%S"]
puts [format "%s %s" $date $temp]
}
puts [format " 显示%s个文件" $n_file]
puts [format " 显示%s目录" $n_directory]
}