- Joined
- May 21, 2013
- Messages
- 1
- Reaction score
- 0
- Points
- 1
I got help from someone to create a script that deletes files in a specific folder after they are more than 2 days old. However, sometimes I get an error message (see attached). The script (see below) is saved as an application that I run automatically at login. If anyone can see something that I'm doing wrong, my appreciation would runneth over. Thank you!
set targetDate to (get current date) - 1 * days
tell application "System Events"
set filesToGo to path of (every disk item of folder "Mac HD:Users:bbotticelliropbox:Brian:Sound Beach Cameras" whose modification date is less than targetDate and visible is true)
tell application "Finder" to delete filesToGo
end tell
set targetDate to (get current date) - 1 * days
tell application "System Events"
set filesToGo to path of (every disk item of folder "Mac HD:Users:bbotticelliropbox:Brian:Sound Beach Cameras" whose modification date is less than targetDate and visible is true)
tell application "Finder" to delete filesToGo
end tell