Can i stop people from deleting a file?
-
Like system files and stuff, when you try to delete them, it says that it cant. I want to know if i can protect a file in some way from deletion, i only want something simple, so if its to complicated dont bother, (or direct me to an article or something, maybe i'll look at it). And no im not making a virus (that would be mean), its for a file encryption thing, and i dont want people to be deleting files that they cant access
-
Like system files and stuff, when you try to delete them, it says that it cant. I want to know if i can protect a file in some way from deletion, i only want something simple, so if its to complicated dont bother, (or direct me to an article or something, maybe i'll look at it). And no im not making a virus (that would be mean), its for a file encryption thing, and i dont want people to be deleting files that they cant access
The Undefeated wrote: and i dont want people to be deleting files that they cant access If they can't access the file, they can't delete it. The only sure fire way to stop this from happening is to set the appropriate NTFS Permissions on the file. You CANNOT stop anyone from deleteing a file through the use of code. Unless, of course, you write a file system extension, which is not for the faint of heart or weak of COM Interop skills! What are you really doing? What's the real goal and what is your project about? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Like system files and stuff, when you try to delete them, it says that it cant. I want to know if i can protect a file in some way from deletion, i only want something simple, so if its to complicated dont bother, (or direct me to an article or something, maybe i'll look at it). And no im not making a virus (that would be mean), its for a file encryption thing, and i dont want people to be deleting files that they cant access
The reason that some of the system files prevent you from deleting them is because they are in use. But I hardly think creating a dummy application that holds a file open to prevent it from being deleted is appropriate. If you don't want it deleted then change file permissions, or keep a 'cache' directory that will replace the file if it notices it is missing. This is something Windows XP does. - Drew