What's wrong with my AppleScript?

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:bbotticelli:Dropbox:Brian:Sound Beach Cameras" whose modification date is less than targetDate and visible is true)
tell application "Finder" to delete filesToGo
end tell

Screen Shot 2013-05-21 at 12.49.40 PM.png
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top