Will
Will

Reputation: 43

C# File Modified Dates

Is there an efficient way to monitor all the files in a directory and determine when they are modified? I'm trying to avoid polling the directory every couple of seconds and running:

File.GetLastAccessTime(string path);

Upvotes: 1

Views: 537

Answers (4)

Michael Kennedy
Michael Kennedy

Reputation: 3380

That's what the FileSystemWatcher class is all about.

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

Good luck

Upvotes: 2

Rob
Rob

Reputation: 1390

Use the FileSystemWatcher - works great!

Upvotes: 1

Matthias
Matthias

Reputation: 516

Maybe File System Watcher suits your needs.

Upvotes: 1

Andrew Hare
Andrew Hare

Reputation: 351698

Are you looking for something like FileSystemWatcher?

Upvotes: 1

Related Questions