Delete folder, subfolders and files within the folder after x days

Hi,

I’m looking for a way to delete the content of certain folders when they are x days old (e.g. 7 days)
On the Macintosh HD I have a folder which contains subfolders and in THESE subfolders I want to delete all old stuff when the user logs in (So I’ll start the script within ‘Login Items’ into the accounts-preferences).

All old stuff in these folders should be removed…
Macintosh HD\Ingest\Capture Scratch
Macintosh HD\Ingest\Audio Render Files
Macintosh HD\Ingest\Render Files

Could you give me a hint or example?

Thanks for your time and attention.

Cheers

you can use shell command to fulfill your request:

find /Ingest/Capture Scratch/ -ctime -7d -delete

this command will find the files changed within 7 days in the directory /Ingest/Capture Scratch/ and delete them. you can use “man find” to find out detail usage of “find” command. you can create a plist file in ~/Library/LaunchAgents to activate this command as user login to the system. If you are not familiar with creating .plist file, you can use the “Lingon” tool to help you to manage the LaunchAgents files.

Model: MacBook Pro late 2010
AppleScript: 2.2.1
Browser: Safari 534.51.22
Operating System: Mac OS X (10.7)

Thanks… I’ll have a try.