> loDirectoryInfo = New DirectoryInfo(cDirectory) > > Try > loFiles = loDirectoryInfo.GetFiles(cFilter) > > ' Get all the files in the directory > For Each loFile In loFiles > loRow = oDataSet.Tables(0).NewRow > > loRow("Extension") = loFile.Extension > loRow("LastUpdate") = loFile.LastWriteTime > loRow("Name") = Trim(loFile.Name) > loRow("Size") = loFile.Length >>
Dim loDirectoryInfo As System.IO.DirectoryInfo loDirectoryInfo = New System.IO.DirectoryInfo("d:\\tmp") For Each loFile In loDirectoryInfo.GetFiles() Dim l As Long = loFile.Length Console.WriteLine("Name: {0} Length:{1}", loFile.FullName, loFile.Length) NextAlso you said the error was 'could not find file' - seems odd that that would occur on the fourth reference to loFile rather than the first ?