Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 12-17-2007, 09:58 AM   #1
cranki
Confirmed User
 
Join Date: Feb 2005
Location: Café del Mar
Posts: 5,162
(PHP?) Scan server for rarely used files?

Is there a way to let php sift through all the files on one's server and delete those which haven't been accessed in a year or so?

I have a shitload of gallery html's which just sit there taking up space...
cranki is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-17-2007, 10:07 AM   #2
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
there's no way to determine what's been accessed. Its possible to do this based on last modified date.

Unless you want it to sift through gigabytes of server logs, in which case php is still not the right language for that
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-17-2007, 10:09 AM   #3
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
Quote:
Originally Posted by k0nr4d View Post
there's no way to determine what's been accessed. Its possible to do this based on last modified date.

Unless you want it to sift through gigabytes of server logs, in which case php is still not the right language for that
FreeBSD records the last time a file was accessed, unless the "noatime" modifier was used when mounting the volume. I'd say Linux also supports this. It shouldn't be too hard to come up with a "find" command that spits out files that have not been touched for a year. I'm too tired to try
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-17-2007, 10:12 AM   #4
wanted
Certified Asshole
 
wanted's Avatar
 
Industry Role:
Join Date: Jan 2003
Location: In front of my laptop.
Posts: 896
On what OS are your files located ?

you can always try to use fileatime()

http://ca3.php.net/manual/en/function.fileatime.php
__________________
Living the dream.

Last edited by wanted; 12-17-2007 at 10:14 AM..
wanted is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-17-2007, 10:14 AM   #5
cranki
Confirmed User
 
Join Date: Feb 2005
Location: Café del Mar
Posts: 5,162
Doesn't this function do that:

http://www.w3schools.com/php/func_fi..._fileatime.asp

?

Or did I misunderstand it?


edit

Quote:
Originally Posted by wanted View Post
On what OS are your files located ?

you can always try to use fileatime()

http://ca3.php.net/manual/en/function.fileatime.php
now I gotta put this into a nifty script... unfortunately I'm not too familiar with php :-/

Last edited by cranki; 12-17-2007 at 10:16 AM..
cranki is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-17-2007, 10:16 AM   #6
Bro Media - BANNED FOR LIFE
MOBILE PORN: IMOBILEPORN
 
Join Date: Jan 2004
Location: Tinseltown NL
Posts: 16,502
fileatime should work, just use it to check, then loop through the directory and unlink() files that haven't been used in x amount of time.
Bro Media - BANNED FOR LIFE is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.