#!/usr/bin/perl -w use strict; use Tk; use File::stat; my $mw;#first window my $logl; #label for log my $logtf; #entry box for the log name my $path=""; #hol my $total=0; $mw = MainWindow -> new(); $logl = $mw ->Label (-text=> '\path', -font=>"Adobe 10")->pack; $logtf = $mw ->Entry (-textvariable=> \$path, width=>25)->pack; my $okb =>$mw -> Button(-text=>'GO', -command => sub {size()})->pack(-side =>'right'); MainLoop; sub size{ chdir $path; opendir DIR, $path; my @file = readdir DIR; closedir DIR; foreach my $file (@file) {$st = stat($file) or die "No $file: $!"; $total = ($st->size)/1048576;#converts from bytes to MB }#foreach print "$total MB for this directory or file"; }#size