KoyoteGambit
New member
I thought I had it, but I'm past frustration and I need some help. I have two directories LOCAL and REMOTE . I want to copy all the files that are in the REMOTE that ARE NOT in the LOCAL to the LOCAL. I have two list boxes that showed the content of both Directories and a copy button, everything works except it is to only copy what is missing from the LOCAL folder, instead its copying all the files. My code is below, what exactly and I doing wrong please?
VB.NET:
Private Sub cmdCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCopy.Click
'Checks the Remote Dir to see if files are in the Local Dir
For k As Integer = ListBoxRemote.Items.Count - 1 To 0 Step -1
For g As Integer = ListBoxLocal.Items.Count - 1 To 0
If ListBoxLocal.Items(g).text = ListBoxRemote.Items(k).text Then
MessageBox.Show("No New Files Founds")
End If
Next g
MessageBox.Show("New File Found. Copying to LOCAL location")
Dim fi As New FileInfo(sRemoteDirName & ListBoxRemote.Items(k))
Dim overwrite As Boolean = True
fi.CopyTo(sLocalDirName & ListBoxRemote.Items(k), overwrite)
Next k
End Sub