Hi, take a look to my coding:
Dim Dir As New DirectoryInfo("C:\Users\Leo\Desktop\Data Lau")
Dim svrDir As New DirectoryInfo(" C:\Users\Leo\Desktop\Server")
Dim FileList As FileInfo() = Dir.GetFiles("*.*", SearchOption.TopDirectoryOnly)
Dim svrFileList As FileInfo() = Dir.GetFiles("*.*", SearchOption.TopDirectoryOnly)
Dim fi As IO.FileInfo
Dim svrfi As IO.FileInfo
Dim isSame As Boolean = False
Dim storfilelist As FileInfo() = Nothing
For Each fi In FileList
For Each svrfi In svrFileList
If fi.Name.Equals(svrfi.Name) Then
'how to write the codes here?
Else
Continue For
End If
Next
Next
I wants to compare two file lists and get all the files which are same name in the two folders. Then I wants to store the selected file object into "storfilelist". How to write the coding insides the for each loop?