Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Clear Downloads Folder using AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Clear Downloads Folder using AppleScript
Authored by: ChaChi on Apr 19, '11 07:41:26AM
Just a FYI... You should use (path to downloads folder) in place of the hard coded path. Hard coding paths in a script is a bad idea.

[ Reply to This | # ]
Clear Downloads Folder using AppleScript
Authored by: Frederico on Apr 19, '11 09:44:22AM

I agree. You could also use (path to me) and employ this script in any other folder, albeit the app name becomes relevant. Perhaps "Empty This Folder" is more universal.

On first read, I could not readily accept this as a good hint; but when I accepted the premise that some users really do use the Downloads folder from the Dock and don't quite always get the concept of exploring Finder directly, and that this essentially adds a constant command to the Dock Grid (or Stack), I had to kinda come around to the idea.

Seems like effort should be made to force it to sort to top or preferably the bottom of the list, though, when the folder is not set to Date Added, so you don't have to hunt for it.



[ Reply to This | # ]
Clear Downloads Folder using AppleScript
Authored by: Frederico on Apr 19, '11 10:29:01AM
I must be really bored today:

tell application "Finder" to move (every item of (container of item (path to me) as alias) whose name is not (name of item (path to me) as text)) to trash

Save the above single line as a compiled application and name it whatever you want; I suggest 'Clear This Folder' or 'Move Contents of This Folder to Trash'.

Be careful where you run it, because it will Trash everything in its directory.

I thought about using do shell script and rm, but this method allows the user to recover with a simple Command-Z (Undo Move).

[ Reply to This | # ]
Clear Downloads Folder using AppleScript
Authored by: leamanc on Apr 19, '11 05:03:51PM

Nice one! I like a simple one-liner, and will be employing this in my Downloads folder...which does get way overloaded with junk seemingly all the time.



[ Reply to This | # ]