views:

46

answers:

3

Hi,

I'm looking to find out a way of seeing when a file was last modified in C#. I have full access to the file.

Thanks in advance

+4  A: 

System.IO.File.GetLastWriteTime is what you need.

Dean Harding
+2  A: 

Just use File.GetLastWriteTime. There's a sample on that page showing how to use it.

ho1
A: 

You simply want the File.GetLastWriteTime static method.

Example:

DateTime lastModified = System.IO.File.GetLastWriteTime("C:\foo.bar");

Console.WriteLine(lastModified.ToString("dd/MM/yy HH:mm:ss"));
Noldorin