Can we block the directory?

I am using VSTS 2008 + C # + .Net 3.5 to develop a console application. To access files, we can access the file in exclusive mode, which blocks another process / thread from accessing the file - which has the effect of “blocking” the file.

I am wondering which directory, is there a built-in API or a solution to make exclusive access to the directory - has the effect of "blocked"? For example, if one thread "locks" a directory, another thread / process cannot call Directory.GetFiles, cannot write a file to a directory, cannot read a file from a directory, etc.

+3
source share
2 answers

, , Mutex . , - () , / .

+1

Source: https://habr.com/ru/post/1717849/


All Articles