Concept99 has asked for the wisdom of the Perl Monks concerning the following question:
What I need to figure out is how to get the script to report "Error" (or something along those lines) in the output, instead of 0. Here is my code:
use File::Find; use strict; my ($dir, @parts); open(IN, "< input.csv") or die("Couldn't open input.csv\n"); open(OUT, "> output.csv") or die("Couldn't open output.csv\n"); @parts=split (/,/,<IN>); #Displays total size of specified path (total includes subfolders) foreach my $dir (@parts) { my $total; print "\nWalking $dir\n"; find(sub { $total += -s }, $dir); $total = ($total / 1024) / 1024; $total = sprintf("%0.2f", $total); print OUT "$dir, $total, mb, \n"; } print "\n\tOutput created.\n"; close(OUT); #Displays program syntax on screen $dir = $ARGV[0];
Here is an example of the contents of the input file:
\\server\share,\\server\different_share,c:\temp
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File::Find question
by Zed_Lopez (Chaplain) on Jun 06, 2003 at 20:40 UTC | |
|
Re: File::Find question
by converter (Priest) on Jun 07, 2003 at 19:12 UTC | |
|
Re: File::Find question
by cciulla (Friar) on Jun 06, 2003 at 19:56 UTC | |
by Anonymous Monk on Jun 06, 2003 at 20:08 UTC |