Protecting a folder from being deleted
I have an application that depends upon a folder existing on the system and I want to prevent the user from being able to delete it. The only way I can think of is to create a dummy file within the folder and keep an active file handle open upon it. This is fine, but I was wondering if there was a more elegant and/or established way of doing this.
My application is activated when the system starts and ends when the system shuts down.
Re: Protecting a folder from being deleted
What do you by "depends upon a folder existing" ? Just the existence? Or it depends on the data you have in the folder?
Cheers
Re: Protecting a folder from being deleted
What about using permission on folder to disable deleting it?
Re: Protecting a folder from being deleted
I believe deleting is the same as writing, so disabling write permission should disable deleting.
Look up the SetFileSecurity() function.
This should do the trick.