fileprop $filenameApproaches the look and feel of Windows Explorer file property dialogs (minus notebook, detailed file type, and icon), but written in pure Tk so should run wherever.
proc fileprop pathname { set padx 6 if {$pathname=="."} {set pathname [pwd]} set pathname [file join [pwd] $pathname] set checkbuttons [list] file stat $pathname a ;# may error out if no such file set w .[clock clicks] set ::$w\(dir) [file dir $pathname] set ::$w\(file) [file tail $pathname] toplevel $w wm title $w [file nativename $pathname] wm resizable $w 0 0 set textual [list Name [file tail $pathname] \ Directory [file nativename [file dir $pathname]] \ Type [file type $pathname]\ Size "[file size $pathname] Bytes"\ Created [date,time $a(ctime)]\ "Last modified" [date,time $a(mtime)]\ "Last accessed" [date,time $a(atime)]\ ] foreach {name value} [file attr $pathname] { if [regexp {^[01]$} $value] { lappend checkbuttons $name $value } else { lappend textual $name $value } } set n 0 foreach {name value} $textual { grid [label $w.${n}n -text $name:] [label $w.${n}v -text $value]\ -sticky w -padx $padx incr n } grid [hr $w.$n] -sticky we -columnspan 2 -padx $padx -pady 6 set n0 [incr n] foreach {name value} $checkbuttons { incr n set ::$w\($name) $value grid [checkbutton $w.$n -text $name -var $w\($name) -borderwidth 0]\ -sticky w -col 1 -padx $padx } grid [label $w.att -text Attributes:]\ -row $n0 -sticky w -padx $padx grid [hbuttons $w.b [list \ OK "fileprop:apply $w; destroy $w; unset $w" \ Cancel "destroy $w; unset $w" \ Apply "fileprop:apply $w" \ ]] -col 1 -padx $padx wm protocol $w WM_DELETE_WINDOW "destroy $w; unset $w" focus $w } proc fileprop:apply {w} { upvar #0 $w a set cmd [list file attributes [file join $a(dir) $a(file)]] foreach {name value} [array get a] { if [regexp {^-} $name] {lappend cmd $name $value} } eval $cmd } proc hbuttons {w tc} { frame $w set n 1 foreach {t c} $tc { button $w.$n -text $t -command $c -width 8 incr n } eval pack [winfo children $w] -side left -padx 3 -pady 6\ -fill x -anchor e return $w } proc hr {w} {frame $w -height 2 -borderwidth 1 -relief sunken} proc date,time {{when {}}} { if {$when == ""} {set when [clock seconds]} return [clock format $when -format "%Y-%m-%d,%H:%M:%S"] }
Still missing: On Unixes, you get the permissions as an octal number - parse, assign to {user/group/others} times {read/write/execute} checkboxes.
MSW says, Nice, but, there's more to unix: sticky bits, suid, sgid, and no archive, hidden or readonly attributes, plus file owner (user & group). I think the mac folks have their own bowel of maggots, too, so should split the attributes in a platform dependant way (i.e. only display what's right given tcl_platform)