Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Can i stop people from deleting a file?

Can i stop people from deleting a file?

Scheduled Pinned Locked Moved C#
securityquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anthony Mushrow
    wrote on last edited by
    #1

    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

    D A 2 Replies Last reply
    0
    • A Anthony Mushrow

      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

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • A Anthony Mushrow

        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

        A Offline
        A Offline
        afinnell
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups