[thelist] CGI atime problem (again)

Algian algian at algian.com
Sat Sep 23 16:20:51 CDT 2000


AHHH! :)
I'm sorry but my email just died all of a sudden. I couldn't connect
to my server so i had to undo and redo the account and i think...well
i'm quite sure i must have missed the reply's to this little problem that
i sent out a few days back..I'm awefully sorry about that....
Well there's a copy of the question below incase you were wondering..
sorry about this but i rally need to find a way around this... :)

thanks
Algian


hello evolters,
this script is starting to give me a headache...it's beyond me why it
doesn't work
What it's meant to do is simply delete files that haven't been accessed for
at least 5 hours. The major problem being that when i tried debugging the
code
using print and printing the results i was amazed at the fact that the print
results
were always along these lines:

$now                 $atime          $tot
969567063 - 969490800 = 76263

Now this looks apparently normal if it weren't for the fact that $atime
NEVER changes!!! even if the file was just created like 2 seconds ago
and accessed at that same time to write stuff into the file it still gives
me 969490800
as the last access time...
this leaves me very perplexed.....I'm using windows 98 so maybe that has a
different
"time" than linux but i doubt thats the problem...
any ideas?

thanks
Algian

print "Content-type: text/html\n\n";

#get the time now and set time limit
my $dir = "f:/apache/htdocs/cgi-bin/temp";
my $now = time;
my $secs = 18000;

#get the file and delete as appropriate
opendir(TEMP, $dir);
  foreach (readdir(TEMP)) {

   #if its a normal file then delete it after 5 hours of it not being
touched
   if($_ ne "." && $_ ne "..") {
    my $atime = (stat "$dir/$_")[8];
    if (($now - $atime) > $secs) {
     $tot = $now - $atime;
     print "$now - $atime = $tot";
     unlink("$dir/$_");
    }
   }

  }
closedir(TEMP);

/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\
Alessandro Giannone
Web Anomaly Creator
Edinburgh University
Department of Science & Engineering
\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/


---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !
/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\/|\
Alessandro Giannone
Web Anomaly Creator
Edinburgh University
Department of Science & Engineering
\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/\|/





More information about the thelist mailing list