D
Daniel Di Vita
II want to compare how many seconds there are between files. If the files are
within a 1 - 10 second range I want to copy them to their own folders. What I
have so far is a couple methods that take in all the files in a directory /
subdirectories and sort them by their lastWriteTime stamp:
Dim flist As List(Of System.IO.FileInfo)
Private Sub writeDirectories(ByVal ParentPath As String)
For Each sDirectory As String In
System.IO.Directory.GetDirectories(ParentPath)
flist.AddRange(New DirectoryInfo(sDirectory).GetFiles())
writeDirectories(sDirectory)
Next
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
flist = New List(Of System.IO.FileInfo)
writeDirectories("C:\Documents and Settings\ddivita\My Documents")
flist.Sort(AddressOf SortByLastWriteTime)
End Sub
Private Function SortByLastWriteTime(ByVal x As System.IO.FileInfo, ByVal y
As System.IO.FileInfo) As Integer
Return x.LastWriteTime.CompareTo(y.LastWriteTime)
End Function
I then want to take the flist and compare the TimeSpan between files. Here
is an example:
File1 - TimeStamp - 5:16:46
File2 - TimeStamp - 5:16:50
File3 - TimeStamp - 5:16:54
File4 - TimeStamp - 3:56:37
File5 - TimeStamp - 3:56:42
I realize I would need to compare file1 to file2, then file2 to file3, and
so on. I figure I could use the timespan class to help with this. Any ideas?
Thanks
Daniel
within a 1 - 10 second range I want to copy them to their own folders. What I
have so far is a couple methods that take in all the files in a directory /
subdirectories and sort them by their lastWriteTime stamp:
Dim flist As List(Of System.IO.FileInfo)
Private Sub writeDirectories(ByVal ParentPath As String)
For Each sDirectory As String In
System.IO.Directory.GetDirectories(ParentPath)
flist.AddRange(New DirectoryInfo(sDirectory).GetFiles())
writeDirectories(sDirectory)
Next
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
flist = New List(Of System.IO.FileInfo)
writeDirectories("C:\Documents and Settings\ddivita\My Documents")
flist.Sort(AddressOf SortByLastWriteTime)
End Sub
Private Function SortByLastWriteTime(ByVal x As System.IO.FileInfo, ByVal y
As System.IO.FileInfo) As Integer
Return x.LastWriteTime.CompareTo(y.LastWriteTime)
End Function
I then want to take the flist and compare the TimeSpan between files. Here
is an example:
File1 - TimeStamp - 5:16:46
File2 - TimeStamp - 5:16:50
File3 - TimeStamp - 5:16:54
File4 - TimeStamp - 3:56:37
File5 - TimeStamp - 3:56:42
I realize I would need to compare file1 to file2, then file2 to file3, and
so on. I figure I could use the timespan class to help with this. Any ideas?
Thanks
Daniel