Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use CGI qw(-oldstyle_urls :standard); use CGI::Carp qw(fatalsToBrowser); use File::Find; use File::stat; my $mytime=(time); my $file_stat; my $all_session = "../sessions"; print header(); print qq(<br><br><table width="600" border="1" bgcolor="#808080" cellp +adding="2" cellspacing="0"> <tr><form action="wacko_del_old_files.pl" method="post" style +="margin: 0px; padding: 0px;"> <td align="left" colspan=\"2\"> Sessions.</td> </tr> <tr><td align="left" colspan=\"2\"> </td></tr>); opendir(DIR, $all_session) or die "Couldn't open directory, $!"; while (my $sessions = readdir DIR) { # Use a regular expression to ignore files beginning with a peri +od next if ($sessions =~ m/^\./); my $age = (time() - (stat("$all_session/$sessions"))[10]); print "<tr> <td align=\"left\"> $sessions - age= $age</td> <td align=\"left\"> <input type=\"checkbox\" name= +\"del_sessions\" value=\"$sessions\"> </td> </tr>"; } closedir DIR; print "<tr> <td colspan=\"2\" align=\"right\"> <td><input type=\"s +ubmit\" value=\"Delete\"></td></td> </tr></form> </table>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing files age information help!
by oko1 (Deacon) on Jan 16, 2011 at 19:07 UTC | |
|
Re: Printing files age information help!
by Anonymous Monk on Jan 16, 2011 at 18:46 UTC | |
by Anonymous Monk on Jan 16, 2011 at 19:00 UTC | |
by Anonymous Monk on Jan 16, 2011 at 19:11 UTC | |
by Anonymous Monk on Jan 16, 2011 at 21:37 UTC | |
by Anonymous Monk on Jan 16, 2011 at 21:49 UTC | |
|