Knowing when the trash is empty

After moving lots and lots of cache files to the Trash via “delete selection”, I then “empty trash”.

The challenge occurs when this code immediately precedes a “shut down” or “restart”; these snippets are executed way before the Trash is actually empty.

So, how can I delay going to “shutdown” or “restart”, for example, by first examining the size of the Trash and make certain this size is zero.

I just thought of a very obvious solution to my own question; namely, call:
delay 15 – or whatever time I think it will take.

The question of getting the size of the Trash in OS X is apparently an elusive one based on other posts pertining to this issue … but I’ll leave that to bigger brains than me.

Here’s one way to do it:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]