Folder / Directory lock so only running application (and child processes) can modify it

StackOverflow https://stackoverflow.com/questions/21471428

  •  05-10-2022
  •  | 
  •  

سؤال

I'm wondering if there is a way for a process to "lock" a complete folder/directory and not allow any other process (except its child process created using Process.Start) to modify/delete anything in there. I don't mind allow read-only access, but that's not a requirement.

The idea is that MyProcess should be able to acquire a lock on a DIRECTORY (not a file) and not allow any other process to modify the contents of that directory. It is a requirement however that the INHERITED PROCESS (started using Process.Start() from MyProcess) should be able to modify that directory, but no one else.

I'm using C# (Windows environment).

لا يوجد حل صحيح

نصائح أخرى

The simple answer is: No. This is not a scenario supported by the operating system.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top