D
Dennis English
Hi
The following code came be very slow in getting
creation time,filename,file length and directoryname
for files in a subdirectory because it keeps checking
each file sequentially in a slow DSL connection
Does anybody know how I can speed things? One suggestion
was to get the remote server to only bring back
creation time,filename,file length and directoryname of all
files in a subdirectory newer than a certain date, all in one shot.
_old code
Private Sub CheckPeMCopiedFilesAgainstDB()
Dim PemDir As IO.DirectoryInfo
Dim SubDir As IO.DirectoryInfo
Dim TypeDir As IO.DirectoryInfo
Dim PemFile As IO.FileInfo
Dim dtFiles As DataTable
dtFiles = CreateFileTable()
Dim drFile As DataRow
Dim dv As DataView
Dim ds As New DataSet()
Dim dtMaintDB As DataTable
Try
PemDir = New
IO.DirectoryInfo(Configuration.ConfigurationSettings.AppSettings.Item("pem_copies_file_path"))
For Each SubDir In PemDir.GetDirectories()
For Each TypeDir In SubDir.GetDirectories
For Each PemFile In TypeDir.GetFiles()
If PemFile.CreationTime >
Convert.ToDateTime(txtPemDate.Text) Then
drFile = dtFiles.NewRow
drFile("Folder") =
PemFile.DirectoryName
drFile("Create Date") =
PemFile.CreationTime
drFile("File Name") = PemFile.Name
drFile("Size") = PemFile.Length
dtFiles.Rows.Add(drFile)
End If
Next
Next
Next
The following code came be very slow in getting
creation time,filename,file length and directoryname
for files in a subdirectory because it keeps checking
each file sequentially in a slow DSL connection
Does anybody know how I can speed things? One suggestion
was to get the remote server to only bring back
creation time,filename,file length and directoryname of all
files in a subdirectory newer than a certain date, all in one shot.
_old code
Private Sub CheckPeMCopiedFilesAgainstDB()
Dim PemDir As IO.DirectoryInfo
Dim SubDir As IO.DirectoryInfo
Dim TypeDir As IO.DirectoryInfo
Dim PemFile As IO.FileInfo
Dim dtFiles As DataTable
dtFiles = CreateFileTable()
Dim drFile As DataRow
Dim dv As DataView
Dim ds As New DataSet()
Dim dtMaintDB As DataTable
Try
PemDir = New
IO.DirectoryInfo(Configuration.ConfigurationSettings.AppSettings.Item("pem_copies_file_path"))
For Each SubDir In PemDir.GetDirectories()
For Each TypeDir In SubDir.GetDirectories
For Each PemFile In TypeDir.GetFiles()
If PemFile.CreationTime >
Convert.ToDateTime(txtPemDate.Text) Then
drFile = dtFiles.NewRow
drFile("Folder") =
PemFile.DirectoryName
drFile("Create Date") =
PemFile.CreationTime
drFile("File Name") = PemFile.Name
drFile("Size") = PemFile.Length
dtFiles.Rows.Add(drFile)
End If
Next
Next
Next