/    Sign up×
Community /Pin to ProfileBookmark

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

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYJan 09.2006 — 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
Copy linkTweet thisAlerts:
@NogDogJan 09.2006 — 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.
Copy linkTweet thisAlerts:
@chazzyJan 09.2006 — 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.
Copy linkTweet thisAlerts:
@katasovaauthorJan 09.2006 — 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 ?
×

Success!

Help @katasova spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...