Restrict Directory Deletion

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
 
C

Ciaran O''Donnell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top