windymiller
Member
- Joined
- Feb 10, 2009
- Messages
- 5
- Programming Experience
- Beginner
What I am trying to do is search through a list of file names looking for files with the same File name
the following code is run from a button on the form
The code seem to work ok up to the Array the line marked with ### is the line that the code stops at run time. Can someone explain where I am going wrong
the following code is run from a button on the form
The code seem to work ok up to the Array the line marked with ### is the line that the code stops at run time. Can someone explain where I am going wrong
VB.NET:
Dpath = cboFolder.SelectedItem
Dim filelist As System.Collection.ObjectMode1.ReadOnlyCollection(of String)
Dim csvfile as String
Dim nofiles as Integer
filelist = My.Computer.FileSystem.GetFiles(Dpath, FileIO.SearchOption.SearchAllSubDirectories, filter)
sw = IO.File.AppendText("FileDuplicate.csv")
noFiles = filelist.Count
MsgBox(noFiles) This gives the correct number of files
For duplicates As Integer = 0 To noFiles
For Each foundfile as String in filelist
Dim fi as FileInfo = New FileInfo(foundfile)
For duplicatez as Integer = duplicates To noFiles - 2
If (fi.Name(duplicates)) = (fi.Name(duplicatez - 1)) Then '####
csvfile = fi.Directory & "," & fi.name
sw.WriteLine(csvfile)
End If
Next
Next
Next
sw.close()
Last edited by a moderator: