How to run code after hook_node_delete has completely run? I have a node to which I have a number of images attached through the usual content type image field mechanism.  The attachment is done correctly, such that when I delete the node, the images are also deleted.  

My problem is that these images are held in a subdirectory, which is not deleted by the file deletion process, and I end up with a bunch of empty and useless directories littering my file system.  I tried deleting the directory with hook_node_delete(), but this fails because Drupal hasn't yet gotten around to deleting the images when that hook gets called, and the rmdir() function I was using to delete the directory fails because the directory isn't empty.

So: Is there a hook I can call that will run after the files have been deleted?  I suppose I could write my own code in hook_node_delete() to delete the files and then the directory, but I'd rather not hack around the architecture like that, if possible.
You may want to look into hook_field_attach_delete().  This runs after all fields have been removed from a node/entity.  So, if all the file fields (and the actual files) have been removed, and all of them in such a node are all in one directory and they are the only files in that directory, removing that directory in this hook should succeed.