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:
01021042
Vues:
29
Well, here is another sample. Pick the best parts of both ;) I tested this one with 160K files distributed in 112 directories...
Imports System.IO
Module Module1
    Dim filecount As Int32 = 0
    Dim datEarliest As DateTime = Now()
    Sub Main()
        Console.WriteLine(Now())
        Dim strDir As String = "s:\projects\pd\scans\"
        Dim theSubDir As String
        For Each theSubDir In Directory.GetDirectories(strDir)
            AddFilesToDb(theSubDir)
        Next
        Console.WriteLine(Now())
        Console.WriteLine(filecount)
        Console.WriteLine(datEarliest)
        System.Threading.Thread.Sleep(5000)
    End Sub
    Private Sub AddFilesToDb(ByVal theDirectory As String)
        Dim theFile As String
        For Each theFile In Directory.GetFiles(theDirectory)
            filecount += 1
            If File.GetLastWriteTime(theFile) < datEarliest Then datEarliest = File.GetLastWriteTime(theFile)
            'Path.GetFileName(theFile) ' This will return just the file name - no path
            'Path.GetFileNameWithoutExtension(theFile) ' this will return file name no path and no extention.
        Next
    End Sub

End Module
Ricardo A. Parodi
eSolar, Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform