[Diy_efi] need help w/archives
Sean Olson
sto9013 at ksu.edu
Tue May 21 17:38:20 GMT 2002
Steve,
Here's a slight modification of Eric's script to display file sizes:
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
#!/usr/bin/perl -w
use strict;
use File::stat;
while (<>) {
chomp;
my $file = $_;
chop; chop; chop; chop;
my $date = $_;
my $size = stat($file)->size / 1024;
print <<ROW;
<tr>
<td>$date:</td>
<td>
<A href="$date/thread.html">[ Thread ]</a>
<A href="$date/subject.html">[ Subject ]</a>
<A href="$date/author.html">[ Author ]</a>
<A href="$date/date.html">[ Date ]</a>
</td>
<td><A href="$file">[ Text $size KB ]</a></td>
</tr>
ROW
}
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
BTW, there's no real reason to use chop like I did, regular expressions
work just fine. However, that function just makes me smile. Especially
in groups like that...
Hope this helps,
Sean
On Mon, 20 May 2002, steve ravet wrote:
> I need a volunteer who can write a script to take a directory listing
> from a file formatted like this:
>
> 1996-January.txt
> 1996-February.txt
> 1996-March.txt
>
> etc.
>
> And generate some html output like this:
>
> <tr>
> <td>1996-January:</td>
> <td>
> <A href="1996-January/thread.html">[ Thread ]</a>
> <A href="1996-January/subject.html">[ Subject ]</a>
> <A href="1996-January/author.html">[ Author ]</a>
> <A href="1996-January/date.html">[ Date ]</a>
> </td>
> <td><A href="1996-January.txt">[ Text 102 KB ]</a></td>
> </tr>
>
> One entry like the above for each filename. Part of it is finding out
> how big the file is and putting that as part of the text in the final
> link. Perl would be best. I need to do this for every month from May
> 1994 to the present, all 3 lists, hence the need for a script.
>
> Please respond directly.
>
> thanks,
> --steve
>
>
> --
> Steve Ravet
> steve.ravet at arm.com
> ARM,Inc.
> www.arm.com
>
> _______________________________________________
> Diy_efi mailing list
> Diy_efi at diy-efi.org
> http://www.diy-efi.org/mailman/listinfo/diy_efi
>
_______________________________________________
Diy_efi mailing list
Diy_efi at diy-efi.org
http://www.diy-efi.org/mailman/listinfo/diy_efi
More information about the Diy_efi
mailing list