Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting a file opening

Is it possible in the Windows environment to detect if a file is being opened with with .NET

I would like to place a handler on the file system to detect if a file or any file is being opened, is this possible?

like image 658
Coppermill Avatar asked Jan 30 '26 00:01

Coppermill


1 Answers

The simplest solution would be to use a FileSystemWatcher and set the filter to NotifyFilters.LastAccess, which will tell it to watch for a change in the last access date/time.

like image 185
Noldorin Avatar answered Jan 31 '26 19:01

Noldorin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!