Restrict Directory Deletion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • miztaken

    Restrict Directory Deletion

    Hi there,
    My C# application opens a directory and deals with the files inside
    it. But at the mean time i can delete the directory from windows.
    Is there any way i can restrict the deletion of that directory when
    its being used by my application.
    I need to do like

    1. open directory by application.
    2. lock it by application.
    3. deal with directory's content.
    4. unlock directory
    5. exit application.

    Do i have to use ACL for this?

    please help me
    miztaken

  • =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?=

    #2
    RE: Restrict Directory Deletion

    You can open a file stream on a file in the folder and issue a lock on it,
    that would stop the folder being removed but not the files you dont have a
    lock on. You could open each of the files issuing locks. It should still let
    you do things as you own the handle.


    --
    Ciaran O''Donnell
    try{ Life(); } catch (TooDifficultException) { throw Toys(); }



    "miztaken" wrote:
    Hi there,
    My C# application opens a directory and deals with the files inside
    it. But at the mean time i can delete the directory from windows.
    Is there any way i can restrict the deletion of that directory when
    its being used by my application.
    I need to do like
    >
    1. open directory by application.
    2. lock it by application.
    3. deal with directory's content.
    4. unlock directory
    5. exit application.
    >
    Do i have to use ACL for this?
    >
    please help me
    miztaken
    >
    >

    Comment

    Working...