Empty the Trash from scripts

So you want to hack up a quick script that will, for example, clear your NetPositive cache and history, delete all those temporary buffers that vi leaves around, and best of all, empty the Trash.

On first thought, you might think this would be a simple task, just:

rm -rf /boot/home/Desktop/Trash/*

Right? Right? Wrong!

There are two reasons why that won’t cut the mustard. First, if you have trash originating from more than one volume, only the trash coming from your boot volume will actually be deleted. Secondly, you won’t get any visual indication of the emptying process, like you would if you were to empty your Trash via Tracker.

So, you might get fancy and whip this out from your little bag of tricks: