KoyoteGambit
New member
Hey all, I have a problem with a program I'm working on; I have two list boxes that lists files in a directory, Local and Remote. I want to check if the items in the Remote Directory are in the Local Directory and if not to copy the Remote directory files not found to the Local Directory. I'm able to list the files and all but I can't seem to be able to copy the files not found. This is what I have so far;
What am I doing wrong, or whats the correct method please?For k As Integer = ListBoxRemote.Items.Count - 1 To 0 Step -1
If ListBoxLocal.Items.Contains(ListBoxRemote.Items(k)) Then
MessageBox.Show("Item Found")
Else
MessageBox.Show("Item Not Found")
Dim fi As New FileInfo("RemoteDirectoryLocation" & ListBoxRemote.Items(k))
Dim overwrite As Boolean = True
fi.CopyTo("LocalDirectoryLocation" & ListBoxLocal.Items(k), overwrite)
End If
Next