Delete by modification date

I’d use the “the entries in” command from the Akua Sweets package to extract a list of aliases of all the files with a mod date before a given date. Tell the Finder to delete that list and you’re all done:

set theFldr to (choose folder with prompt "Pick a folder:") 
set cutOff to (current date) - (11 * days) 
set delList to (the entries in theFldr ¬ 
that were modified before cutOff ¬ 
whose kinds are file ¬ 
to a depth of -1 as alias) 
tell application "Finder" to delete delList

Hi,
Also, you could use the every element reference form with a filter. I haven’t tried this with modification date less than something yet, but, I think it should work.

et the_folder to choose folder 
set min_date to ((current date) - 11 * days) 
tell application "Finder" 
 delete (every file of the_folder whose modification date is less than min_date) 
end tell

Hope its faster too.

Good luck, Kel.

Wait, there may bne some kind of bug with the filter reference form and dates. Think I read about it at AppleScript Sourcebook.
Later,

Yep, you may want to disregard this. There’s a bug in AppleScript 1.3.7 where, ‘whose modification date < some other date’. It may have been fixed in later versions, but, I don’t know.