Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADIR and ASORT for .NET ?
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01020162
Message ID:
01021042
Views:
28
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform