Reputation: 3
i have a problem with renaming a duplicate file in a folder. How to skip it so that only the original file is renamed?
here is my code:
For i As Integer = 0 To ListView1.Items.Count - 1
My.Computer.FileSystem.RenameFile(ListView1.Items(i).Text, TextBox7.Text)
next
Upvotes: 0
Views: 50
Reputation: 637
There is inherent mistake in the code. You are trying to give same name to multiple files. As per your code, each item of ListView1 obtained through ListView1.Items(i).Text
will be renamed to text mentioned in TextBox7.Text
.
The loop itself is wrong.
Upvotes: 1