LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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

Reply
 
Search this Thread
Old 08-29-2005, 09:54 AM   #1
Azhrarn
Member
 
Registered: Aug 2005
Location: Europe
Posts: 63

Rep: Reputation: 15
Delete files after 24 hours


Hi, I m trying to setup a folder so that its contents are deleted after 48 hours from being placed there.

Based on an old post I would use

find /raid/shared/ -mtime +2 -type f -exec rm -rf {} \;

If I use this script and run it &, will this use up a lot of memory if it always running?

Otherwise, how can I shedule it regulary?

I m on Red Hat 9 with Kde.

Is there a better way?
Thanks a mil!
Bye!!
 
Old 08-29-2005, 10:01 AM   #2
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 45
hi there,
depend on how many times per 48 hours you want to check...
my suggestion: setup a cron, maybe hourly.
i think it will be ok..
regards,
slackie1000
[edit] 1. go to /etc/cron.hourly
2. copy your executable there
3. and it is done. be sure that "crond" is running..

Last edited by slackie1000; 08-29-2005 at 10:02 AM.
 
Old 08-29-2005, 10:05 AM   #3
Azhrarn
Member
 
Registered: Aug 2005
Location: Europe
Posts: 63

Original Poster
Rep: Reputation: 15
that was fast
Thanks a mil!
 
Old 08-29-2005, 12:00 PM   #4
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 45
hi there,
you are welcome!
regards,
slackie1000
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Question - Delete files in a dir older than 48 hours? t3___ Linux - Newbie 5 10-11-2011 03:42 AM
How to delete files that won't delete? di11rod Linux - Security 7 10-19-2005 09:14 PM
Deleting Files Older Than 2 Hours using Find? LinuxGeek Linux - Software 1 06-29-2005 06:10 AM
How to delete the destination files while the source files deleted in cp -u ? myunicom Linux - General 4 09-26-2003 01:13 PM
Can't delete some files... Tomcat_cdm Linux - Newbie 2 03-11-2003 10:26 PM


All times are GMT -5. The time now is 03:04 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration