LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   delete files older than 30 days using cronjob (http://www.linuxquestions.org/questions/linux-newbie-8/delete-files-older-than-30-days-using-cronjob-333477/)

latheesan 06-14-2005 10:36 AM

delete files older than 30 days using cronjob
 
hi, i am a newbie to all this.

i've recently signed up for a hosting package, which i presume it is on a freebsd or linux. not too sure.

the reason why i came here it was because the both system has the cronjob feature, i guess.

anyway. i run a file uploading site call mp3host.info

what i want to do is some sort of cron job comand or tiney php or cgi script that deletes file if it is older than 30 days in sepecific folders.

someone please help me

Matir 06-14-2005 11:11 AM

Try something like:
Code:

find /path/to/files -mtime +30 -exec rm  {}\;
Change /path/to/files as you need, of course. -mtime +30 means "modified 30 or more days ago" and the "-exec rm {}\;" deletes the file.

latheesan 06-14-2005 11:49 AM

omg, that code looks too good to be tru. lolz. i was almost about to buy the script caled Auto Delete II from some next company. lolz

thank you very much for such valuable code.

i o u one buddy

once again, thank u

titanium_geek 06-14-2005 12:14 PM

http://www.linuxquestions.org/questi...highlight=cron

http://www.linuxquestions.org/questi...highlight=cron

these threads are ones I started ages ago- perhaps they did not turn up in your search- if the search was set to look at a year or newer. Helped me, might help you.

titanium_geek

latheesan 06-14-2005 02:33 PM

hahaha

i did search for da keyword cron, but, me being the noob, i had no clue what everyone was talking about.

somehow the previous code kinda made sense. so lets hope it works.

anyway, thanks for your help.

latheesan 06-14-2005 02:40 PM

btw, thank you for the links :)


All times are GMT -5. The time now is 04:39 PM.