Is there a way to automatically have a folder deleted every day at 4am?
I'm running 10.6.7.
Appplescript & iCal
Open Applescript and enter the following code:
Replacing folder with the folder you want to delete, and save the file.
If the folder you want to delete is outside home directory, (for example the folder /Users) then replace the delete line with:
Then open iCal and create a new recurring event at the time you want and as an alarm choose Run Script and select the applescript you created.
Open Terminal.app and enter:
There to the file opened, add the following line
replacing /Users/USER/folder with the full path of your folder and save the file.
Create a new text document, and paste the following code:
Let's call it script.sh
Based on this article, create another new text document and paste the following:
Replace nuc with your account username, and /path/to/script.sh with the full path of the script we created on first step.
Save the file in /Library/LaunchDaemons/ as my_rfd.plist.
Finally, launch Terminal.app and type:
Hazel is a great app for doing this type of thing. It's not free, but it works great.
I use it to "Label" or highlight files that are have been downloaded in the last 24 hours, then to delete files from my downloads folder that are more than 7 days old.
I then have it empty my trash once a month.
This is just the basics of what can be done with Hazel, it's cool.
[I have no financial interest in Hazel]