Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

britishcolumbia

macrumors newbie
Original poster
Oct 6, 2008
10
0
This script is supposed to delete files out of my downloads stack but it doesnt do ANYTHING. no errors, no result, no nothing...
FYI "The Mothership" is my internal HDD and "Jackman" is my home folder.

Code:
tell application "Finder"
	
	try
		
		delete (every item of folder "Downloads" of folder "Jackman" of disk "The Mothership" whose modification date is less than ((get current date) - 1 * days))
	end try
	
end tell
 

moshpitwookie

macrumors newbie
Mar 3, 2009
8
0
Hi britishcolumbia

I copied your script and added in the "Users"
----------------
tell application "Finder"

try

delete (every item of folder "Downloads" of folder "Paul" of folder "Users" of disk "Macintosh HD" whose modification date is less than ((get current date) - 1 * days))
end try

end tell
---------------

it works great! - thanks this is an awesome script!

cheers
 

mysterytramp

macrumors 65816
Jul 17, 2008
1,334
4
Maryland
This will work, too ...

Code:
tell application "Finder"
	try
		move (every item of alias "Macintosh HD:Users:<your user name>:Downloads:" whose modification date is less than ((get current date) - 1 * days)) to trash
	on error errNum number errMsg
		display dialog ("Error: " & errNum as string) & return & errMsg
	end try	
end tell

Advantage ... it moves files to the trash to give you an option before deleting them.

mt
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.