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

Me1000

macrumors 68000
Original poster
Jul 15, 2006
1,794
4
So I got this wonderful little application (made with apple script) that goes inside my downloads stack, so that I can click on it, and it deletes everything inside the downloads folder,

However there is a single folder that I need to keep inside the downloads stack,

the folder is named "Download"

this is the script i am trying to edit,

Code:
try
	tell application "Finder"
		set the_items to (every item of (path to downloads folder as alias) whose name is not "Delete All.app")
		delete the_items
	end tell
on error
	tell application "Finder" to display dialog "An error occurred!" with icon 0 buttons {"Damn"} default button 1
end try


It looks obvious what needs to be edited, however I dont even know where to begin when it comes to apple script!

any help would be great,
thanks,
:)
 

HexMonkey

Administrator emeritus
Feb 5, 2004
2,240
504
New Zealand
Try this:

Code:
try
	tell application "Finder"
		set the_items to (every item of (path to downloads folder as alias) whose name is not in {"Download", "Delete All.app"})
		delete the_items
	end tell
on error
	tell application "Finder" to display dialog "An error occurred!" with icon 0 buttons {"Damn"} default button 1
end try
 

Me1000

macrumors 68000
Original poster
Jul 15, 2006
1,794
4
Thanks,

I cant try it yet, because I have 2 other files in the stack that cant be moved until later this week... :eek:

ill post an update when I can...
:)
 

Me1000

macrumors 68000
Original poster
Jul 15, 2006
1,794
4
Sorry it took so long to try,
unfortionalty that didn't work.
It removes the folder as well...
:eek:
 

HexMonkey

Administrator emeritus
Feb 5, 2004
2,240
504
New Zealand
Are you sure that the folder name exactly matches the name of the folder in the script? In your original post you said it was called "Download"; perhaps it was meant to be "Downloads".
 

Me1000

macrumors 68000
Original poster
Jul 15, 2006
1,794
4
Well I thought that was the problem to begin with, because there was a space at the end of the folder name but I took the space out, and it still didnt work.
however I just looked again, and found that there was a space in front of the folder name too. I added that to the apple script and it works great now!

Thank You,
:)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.