>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 >