Click to See Complete Forum and Search --> : plz hlp


katasova
01-09-2006, 12:58 PM
Hi, i have this problem and im not really sure if there is any way to solve it...

In my site i let users to upload files so they can see it or download it any time they want. Of course there are users that dont use its stored files for weeks or even months. This are trash files that i wish to delete.

My question is, how can i make a .php to delete evrey week all files that were created 1 month ago. Of course this should make an automatic clear when i run it.

I dont want u to place the full code here hehe plz just tell me a general idea on how to do it if it is possible to do it...

THX for ur time

LiLcRaZyFuZzY
01-09-2006, 01:10 PM
you could have a cronjob that deletes them automatically, however, i think you would have to write the 'last used' date to a database or such to see if it wasnt used for 1 month

NogDog
01-09-2006, 01:56 PM
Another way to approach it if cron is not a practical solution for you is to make it part of another script that gets used periodically.

For instance, if there's a login script that each user has to go through each time they access the site, you could add some processing to find and delete old files as part of the login processing.

chazzy
01-09-2006, 02:04 PM
I think if you have a host that uses cPanel (and no direct linux user) you can still setup cron entries to run PHP
but typically, if you can use it, Perl is a better solution than PHP for something that's automatically run.

katasova
01-09-2006, 02:20 PM
thx a lot guys guys u hlp me a ton, i think i will try to make a fake cron in php cause my site is stored in a windows 2000 server (im not sure if i can set cron tasks here) and it is not my own server, im paying for the storage and well u know that any kind of change to the OS means some extra $ hehe

THX again :D