I often let a lot of junk accumulate on my desktop, making it hard to find things. In order to keep the clutter under control, I made folders for each of the kinds of things that end up on the Desktop (music, video, documents, etc.), and then wrote a simple AppleScript to sort files on the Desktop into the correct folders. The script recognizes file types by their extension. Though the file types and destination folders are hard coded, they are set at the top of the script and should be trivial to change.
I run this script from Quicksilver when I feel my Desktop is getting out of control, but there's no reason you couldn't run it automatically as a folder action instead.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20061104095603502