开发者

Find what change occured when the Changed event is fired in a FileSystemWatcher

I am using a FileSystemWatcher to monitor changes to files.

MSDN documentation says that if Changed is passed for开发者_开发知识库 the ChangeType in the FileSystemEventArgs parameter, it indicated "The change of a file or folder. The types of changes include: changes to size, attributes, security settings, last write, and last access time."

Is there a way to find out which one of those changed? For example, last access can alone change without change to size. I want to find that out. How can I do it?

P.S. Of course if I record all the attributes that I care about every time Changed event is fired, and then compared them, I can find out what changed. But is there an easier way.. like being notified through some event or reading a property of some object? :D


You can use FileSystemWatcher.NotifyFilter to filter events based on what happened. MSDN

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜