Your delete.php file had some invalid function calls. I've updated it and it seems to work.
I think the Dreamweaver delete is just too slow and the site is in use. By the time it finishes deleting all of the images in a directory, that directory is no longer empty. Then it tries to delete the directory and it can't because it isn't empty.