LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Delete files after 24 hours (https://www.linuxquestions.org/questions/linux-newbie-8/delete-files-after-24-hours-358102/)

Azhrarn 08-29-2005 09:54 AM

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!!

slackie1000 08-29-2005 10:01 AM

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..

Azhrarn 08-29-2005 10:05 AM

that was fast :D
Thanks a mil!

slackie1000 08-29-2005 12:00 PM

hi there,
you are welcome! :cool:
regards,
slackie1000


All times are GMT -5. The time now is 11:43 PM.