You can use "Named Mutex". It helps you to say "Hey wait, am working on with that file!". It is your call you can wait or ignore that file.
Take a look at Mutex class
Also worth noting that by default if you open a file, FileShare
will be None
which means don't share access with anyone till I close the file. So it will fail when attempt to access in another process. You can't modify it simultaneously. To prevent that failure and handling exception and all using "Mutex" is a elegant way.