Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
06-14-2005, 10:36 AM
|
#1
|
|
LQ Newbie
Registered: Jun 2005
Posts: 9
Rep:
|
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
|
|
|
|
06-14-2005, 11:11 AM
|
#2
|
|
Moderator
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,505
Rep: 
|
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.
|
|
|
|
06-14-2005, 11:49 AM
|
#3
|
|
LQ Newbie
Registered: Jun 2005
Posts: 9
Original Poster
Rep:
|
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
|
|
|
|
06-14-2005, 02:33 PM
|
#5
|
|
LQ Newbie
Registered: Jun 2005
Posts: 9
Original Poster
Rep:
|
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.
|
|
|
|
06-14-2005, 02:40 PM
|
#6
|
|
LQ Newbie
Registered: Jun 2005
Posts: 9
Original Poster
Rep:
|
btw, thank you for the links 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:45 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|