Needless to say, you should use this script with caution! It is mainly intended as an example, albeit a potentially useful one. Download either the script application or the text version or both. Note that you can drag the script application onto Script Editor to edit it, so the text version isn't strictly necessary.
The dirty work is handled with the command-line command "rm -rP" and AppleScripts's "do shell script" and "POSIX path" from the "Standard Additions" scripting addition are what do that.
You are free to use this script in any way you see fit as long as nothing in it is used in a for-profit endeavor. No warranties are expressed or implied - i.e. any damage caused by it is your own damn fault! Please DO suggest improvements.

