Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#Lets assume that the locations will be passed like: c:/progra~1/apache~1/apache2/htdocs/a_error1 c:/progra~1/apache~1/apache2/htdocs/a_error2 into an array @local_list; #Open directory and search for *.TXT files my(@dircontent, $filesize, $file); for my $path(@local_list) { opendir my $dirh,$path or die "Can't open $path"; push (@dircontent,grep { /\.txt$/ } readdir($dirh)); closedir($dirh) or die "Can't close $path"; } #After finding all the text files I need to get the file names and it' +s size and print it out, but I am loosing value after the first file, + why? my $list_count=-1; foreach my $file (@dircontent) { $list_count++; $filesize = -s $file; print "<br><b>L123 - $list_count - The file name: <a href=../../$l +ocal_list[$list_count]/$file>$file</a></b> is <font color=red>$filesi +ze</font> bytes long.<br>\n\n"; #exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File Size in Directory
by physi (Friar) on Feb 14, 2006 at 19:17 UTC | |
by Anonymous Monk on Feb 14, 2006 at 19:33 UTC | |
|
Re: File Size in Directory
by davidrw (Prior) on Feb 14, 2006 at 19:25 UTC | |
|
Re: File Size in Directory
by holli (Abbot) on Feb 14, 2006 at 19:52 UTC | |
|
Re: File Size in Directory
by smokemachine (Hermit) on Feb 14, 2006 at 19:29 UTC | |
|
Re: File Size in Directory
by ayrnieu (Beadle) on Feb 15, 2006 at 07:06 UTC |