Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: (nrd) How long have you been sitting on my server?

by newrisedesigns (Curate)
on Jan 27, 2003 at 18:16 UTC ( #230295=note: print w/ replies, xml ) Need Help??


in reply to How long have you been sitting on my server?

Why don't you walk over the directories in your webserver and check each file using the last modified file test operator?

if(-M $_ > 30*86400){ unlink $_; }

Hope this helps. If not, post a reply. Why don't you sign up for Perl Monks, while you're at it.

John J Reiser
newrisedesigns.com


Comment on Re: (nrd) How long have you been sitting on my server?
Download Code
Re: Re: (nrd) How long have you been sitting on my server?
by Anonymous Monk on Jan 27, 2003 at 18:25 UTC
    Why don't you walk over the directories in your webserver and check each file using the last modified file test operator?

    The last modified test operatior (-M) is exactly what I am using. I am sorry that I confused this with the age of the file. The problem is that a file could have been modified months ago, and when the file gets upload to the server, its last modified time doesn't change. I need to know how long the file has been on the server, not the last time it has been modified or accessed.

      What FTP server/operating system do you use?

      I have a "last updated" script on my server. It checks a few directories for HTML files and sorts them according to the return value of -M. If I upload a file using FTP to my server, the value returned from -M is set to the time of the upload. I just tested this on my server using a HTML file that was two months old. It shows up first in the list, being updated "0 seconds ago" (upon reload of the CGI script).

      I'm pretty sure that a file uploaded sets it's last modified value to whatever the time of upload was. If the file was copied to the FTP directory using your operating system and not via FTP, I can see how -M wouldn't work.

      Hope this helps.

      John J Reiser
      newrisedesigns.com

Re: Re: (nrd) How long have you been sitting on my server?
by iguanodon (Curate) on Jan 27, 2003 at 20:53 UTC
    if(-M $_ > 30*86400){ unlink $_; }
    That's some ancient files, man! -M returns the age of the file in days.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://230295]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (15)
As of 2014-07-31 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (248 votes), past polls