I wanna make a programm that doesn't allow an user to delete a file or a directory. I think that I should hook the delete system messasge and replace it or ban it! Anyone has an ideea?
System.IO.FileSystemWatcher class will allow you to catch a file delete event. Don't know how you will be able to catch a beforeDelete event. You could keep a backup copy somewhere and then copy a new version in if it gets deleted.
Whatever you do you will need a persistent process such as a Windows service to be running to monitor the events and react accordingly.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.