Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Obtaining oldest file in a directory
Message
 
À
17/09/2008 18:53:31
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01348390
Message ID:
01348480
Vues:
15
Hi Tim,

since you are only interested in the name you could modify the code like this:
System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(@"C:\");
String name = info.GetFiles("*.jpg").OrderBy(x => x.LastWriteTime).First().Name;
I'm not sure which date you want to check. LastWriteTime would be the time stamp you see in Explorer.
--
Christof
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform