-2

I have a question. I want to get/read/load one XML-File('Last Modified') from the ordner by using Visual Basic(or C#). The Ordner contains many XML-Files. But I need just one of them 'Last Modified' or 'Updated in the Ordner.

Could anyone give a suggestion?

curveball
  • 4,320
  • 15
  • 39
  • 49
Ferat
  • 1
  • 1
    Possible duplicate of [How to find the most recent file in a directory using .NET, and without looping?](https://stackoverflow.com/questions/1179970/how-to-find-the-most-recent-file-in-a-directory-using-net-and-without-looping) – MatSnow Oct 05 '18 at 11:18

1 Answers1

0

My Approach would be (in c#):

DirectoryInfo d = new DirectoryInfo("YourPath");
DateTime DS;

foreach (FileInfo fileName in d.EnumerateFiles("*.xml"))
{
    DS = Convert.ToDateTime(fileName.LastWriteTime);
}

Now you get all the dates and you simply have to look for the newest one :)

Note: you can select different parameters after fileName., for example CreationTime

Shmosi
  • 322
  • 2
  • 17