#!perl -w use strict; use File::Find; use Tk; use Tk::Frame; use Tk::Text; use Tk::Scrollbar; use Tk::Adjuster; # Main Window my $mw = new MainWindow; $mw->geometry('400x300'); # Main Frame my $lf = $mw->Frame; # Left Frame; my $aj = $mw->Adjuster(-widget => $lf, -side => 'left'); my $rf = $mw->Frame; # Right Frame; # Args my $path = $ARGV[0]; # path passed in on the cmd line # create list of directories my %dirs; find(sub {$dirs{$File::Find::dir}++;}, $path); my($ListBox) = $lf->Scrolled('Listbox', -height => '0', -width => '0', -scrollbars => 'e', ); my($OutputText) = $rf->Scrolled('Text', -height => '1', -width => '1', -scrollbars => 'osoe', ); # Load dir names into the listbox $ListBox->insert('end', keys %dirs); # Left mouse button calls display sub $ListBox->bind('', sub { OnShowFileAttr(); } ); # Pack everything $lf->pack(qw/-side left -fill y/); $aj->pack(qw/-side left -fill y/); $rf->pack(qw/-side right -fill both -expand 1/); $ListBox ->pack(qw/-side left -fill both -expand 1/); $OutputText->pack(qw/-side bottom -fill both -expand 1/); # Start the main event loop MainLoop; exit 0; sub OnShowFileAttr { my ($index) = $ListBox->curselection(); my $filestats = join ":", lstat($ListBox->get($index)); $OutputText->insert('end', $filestats."\n"); }