using crontab to empty a directory each morning
I've never used crontab before and I'm wondering if someone could explain to me how I can set it up to remove all files in a specific directory every morning at 2am.
Thank you.
Steve Gliebe
http://digitalart.org
http://dreamdolphin.com
Gliebster posted this at 23:11 — 8th June 2001.
They have: 21 posts
Joined: Sep 2000
Nevermind, I think I did it. I wrote a little script that wipes all the files in the directory except for itself and I set up a cron job to execute the file each morning. I know the script works but I guess I'll have to see if the cron job worked tomorrow morning.
It's always fun to learn new stuff.
Steve Gliebe
http://digitalart.org
http://dreamdolphin.com
Mark Hensler posted this at 00:16 — 9th June 2001.
He has: 4,048 posts
Joined: Aug 2000
No wait... let me guess. You used PHP.
mairving posted this at 01:13 — 9th June 2001.
They have: 2,256 posts
Joined: Feb 2001
Even Easier to do would be a simple script like this
In Linux:
/path to directory/rm * , save it with the .sh extension and chmod it to make it executable.
In Windows:
cd /path to directory
del *
save as a .bat file.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
Mark Hensler posted this at 15:28 — 9th June 2001.
He has: 4,048 posts
Joined: Aug 2000
hmm... I never even thought about that.
.... .bat ... that brings back memories.. hehe
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.