You would also have an issue where your server is not allowing deletion of the files for whatever reason. Maybe because of an ownership issue like your server is throwing the files to be owned by nobody and the script can not delete files by nobody? Just a thought you need to do some testing in that regards as this would appear to be a server permissions issue in that regard and not Photopost oriented. We do clearly attempt to delete the files as I noted by showing that code above.
You can delete files all you want but you can not delete directories