Detect File Read in C#

前端 未结 6 871
眼角桃花
眼角桃花 2020-12-03 22:22

I\'m using FileSystemWatcher to check when a file is modified or deleted, but I\'m wondering if there is any way to check when a file is read by another application.

6条回答
  •  北海茫月
    2020-12-03 23:13

    You could use FileInfo.LastAccessTime and FileInfo.Refresh() in a polling loop.

    http://msdn.microsoft.com/en-us/library/system.io.fileinfo_members.aspx

提交回复
热议问题