Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADIR and ASORT for .NET ?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01020162
Message ID:
01020942
Vues:
18
Einar,

I need to follow the IT standard for the company, which is VB.NET at the moment. In VB.NET as far as I see, the GetFiles() allows to create a one-dimensional array and with file names only. But I need file dates to sort the list. Am I missing anything here?


>Yuri,
>Have you looked at System.IO.Directory.GetFiles()?
>
>
>System.Collections.Specialized.StringCollection myFileCollection = new System.Collections.Specialized.StringCollection();
>string myPath = @"c:\it\";
>string myFileName = "yo*.*";
>
>foreach (string myFile in System.IO.Directory.GetFiles(myPath, myFileName))
>{
>	myFileCollection.Add(myFile);
>}
>
>
>One of the overloads for GetFiles() allows you to specify a search pattern. I have not done any speed tests on this.
>Hope it helps. If find it hard to belive that .NET is slower than VFP when it comes to this. What file system are the files on?
>Sorry about the C# code, but it should be easy to convert to VB.NET.
>
>Einar
>
>
>
>>I need to scan several directories containing about 10000 files each and for files created, say, more than 2 weeks ago during the day hours prior to the current time. There could be about 100 files that should be erased. With VFP ADIR() it is quite easy to do .... And it takes about 1-5 seconds.
>>
>>But I cannot figure out how to do it wisely in VB.NET: the collection object like Scripting.FileSystemObject does not give the ability to sort. Therefore it requires scanning all the files, and checking the date of each of them. It takes about 2-3 minutes per directory.
>>
>>Adding the VFP Toolkit for .NET requires additional installation on the PC, and it is not allowed at the time.
>>
>>Has anyone a suitable solution?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform