Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File's modification date in C#

Tags:

c#

file

I have to write an application, which will compare the modification date of two files. These files are Excel workbooks. The first file is located on a local drive and the second on a LAN network.

Any hints, how to write this app? There's no need to open these files, just to check the date from file attributes.

like image 477
Elfoc Avatar asked Jul 20 '11 15:07

Elfoc


1 Answers

System.IO.FileInfo file1 = new System.IO.FileInfo(file1Name);
System.IO.FileInfo file2 = new System.IO.FileInfo(file2Name);
if(file1.LastWriteTime != file2.LastWriteTime)
    //Do some stuff.
like image 146
DoctorMick Avatar answered Oct 14 '22 13:10

DoctorMick



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!