Sort desktop files

I need to write a script that moves all the desktop files excluding aliases and folders to another folder, and in THAT folder move pictures into one folder, movies into another etc

If the script could be constructed so that it was easy to add new paths and file types to organize so much the better

I’m not quite sure where to start. I think there are some shareware style apps out there that do something like this, but I’d like to lose the GUI and have it adaptable

Thanks in advance

Ok, here’s something to get you started. Note I’ve excluded not only aliases and folders but also ‘volume’. This will ensure that the script doesn’t mess with mounted CDs and HDs, etc.

tell application "Finder"
	set theItems to every item of desktop whose kind is not "Folder" and kind is not "alias" and kind is not "Volume"
	set theMasterFolder to (make new folder at desktop with properties {name:"Master_Folder"})
	repeat with i in theItems
		set iKind to kind of i
		if exists folder iKind of theMasterFolder then
			move i to folder iKind of theMasterFolder
			make new folder at theMasterFolder with properties {name:iKind}
			move i to folder iKind of theMasterFolder
		end if
	end repeat
end tell