Forum Moderators: coopster
What I'm trying to do is have the ability to delete a folder, but only if that entire folder can be deleted. I don't want to have the script delete half the files because of a permissions issue and leave the other half there. It would be better to leave the whole thing and return an error.
My thought is that is_writable should let me know. Can anyone confirm that? It seems that if the file has the right permissions for the script to overwrite it with nothing, it should have the permissions to remove the file.
My other idea if that doesn't work is to check permissions on every file, but I'm not sure whether it would take write or execute permissions to be able to delete a file.
Subfolders seem to work the same way. You can remove an empty directory even if you don't have write permission on it, but you still have to have write permission on the parent.