Restrict Directory Deletion

  • Thread starter Thread starter miztaken
  • Start date Start date
M

miztaken

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
 
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.
 
Back
Top