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.