Remove everything from the desktop

Jan 07, '05 08:38:00AM

Contributed by: KingDoom

I like to keep my desktop clean, so I wrote a very short AppleScript that will remove all items, and eject all non-local disks, from the desktop. I use this after I have downloaded a bunch of programs to my desktop that I no longer need -- usually because they have been installed into my apps folder.

I call the program "Finder CleanDesk." I call the AppleScript via Butler (Command-space then 'fc'). It will then send files on your desktop to the trash, and eject non-local disk images. It will not send your hard drive, iDisk, etc. to the trash -- which is a good thing. You can modify the script to only remove files or only eject non-local disk images. Note that you will want to replace Macintosh HD with the name of your hard drive, and replace username with your short username.

robg adds: This script is quite dangerous. As explained, it moves everything on your desktop to the trash. It does not empty the trash, so you won't lose anything immediately. It does serve a purpose, especially for those who like super-clean desktops ... but be aware of what it does before you use it!
tell application "Finder"
  move every item of alias "Macintosh HD:Users:username:Desktop:" to trash
  eject (every disk whose ejectable is true or not local volume is true)
end tell
[robg adds: Enter the script in Script Editor and save it somewhere you can easily find it. Butler, or one of many other tools, can be used to assign it to a global hotkey. You could also put it in your Scripts menu to make it just a bit harder to run, so as to cut down on accidental uses...]

Comments (12)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050106150428817