How do I open/rename all the files w/i a folder?

MiserableMad

Active member
Joined
Feb 2, 2007
Messages
25
Programming Experience
Beginner
I want to be able to execute a for...next loop to open/rename all the files within a folder. Does that make sense?
 
here is some quick code to give you a jump start

You can put this code into a click event of a button and watch it work.
Be sure you have a folder C:\testFolder or rename the folder in the code.

Be sure you import system.IO

Dim files As System.Collections.ObjectModel.ReadOnlyCollection(Of String)
Dim i As Integer
files = My.Computer.FileSystem.GetFiles("C:\testFolder")

If files.Count >= 1 Then
For i = 0 To files.Count - 1
Rename(files.Item(i).ToString(), "C:\testfolder\renamed" & i & ".txt")
Next
End If
 
Thanks, that is what I want to accomplish. Go change the names of files within the folder, thanks. I cant try this right now but around 4:00pm I will give it a shot thanks.:D
 
Back
Top