C:\Perl\>perl Print_dirs.pl "C:/Perl/" #### #!/bin/perl use warnings; use strict; use File::Find; my $path = $ARGV[0]; die "You must supply a full directory path" unless (-e $path && -d $path); opendir (DIR, $path) or die "can't opendir $path: $!"; my @directories = grep { -d "$path/$_" && ! /^\./ } readdir(DIR); my $total_size_of_files_in_dir; foreach my $dir (@directories) { find(\&wanted, "$path/$dir"); ### Not sure how that worked as you called it $directory print "The total size of the file in $dir is " . sprintf("%.2f Kb", ($total_size_of_files_in_dir * 0.0009765625)) . "\n"; print "The total size of the file in $dir is " . sprintf("%.2f Mb", ($total_size_of_files_in_dir * 9.5367431641e-7)) . "\n"; print "The total size of the file in $dir is " . sprintf("%.2f Mb", (&size_in_mb($total_size_of_files_in_dir))) . "\n"; } sub wanted { if (-f $_) { $total_size_of_files_in_dir += -s; } } sub size_in_mb { my $size_in_bytes = shift; return $size_in_bytes / (1024 * 1024); }