I am new to apple script and am having some issues making this work. I want to be able to delete all files and folders in a certain location older than 7 days. However I would like to ignore some of the folders and not have them deleted. This is the code I have so far but it is not working:
--this happens when you doubble click the droplet
on run
set aFolder to choose folder
processOneFolder(aFolder)
end run
--this happens when you drop folder on droplett
--note that we only work with the first dropped item
on open pathoffolder
processOneFolder(item 1 of pathoffolders)
end open
on processOneFolder(theFolder)
set folderNamesToIgnore to {"Miscellaneous"}
tell application "Finder"
repeat with oneFolder in (get folders of theFolder)
set thisFolderName to name of oneFolder
if thisFolderName is not in folderNamesToIgnore then
if (modification date is less than ((get current date) - 7 * days)) then delete oneFolder
end if
end repeat
end tell
end processOneFolder
Any help would be appreciated.
Thanks in advance.
Model: iMac
AppleScript: 2.1.2
Browser: Safari 534.58.2
Operating System: Mac OS X (10.6)