Rename filenames

  • Thread starter Thread starter Newbie
  • Start date Start date
N

Newbie

Hello,

I'm trying to rename 2000+ jpg files in a directory. all
filenames are similar, so that makes it a little bit
easier. They look like at123456a, at123457a, etc.

What I need to do is delete the "t" in the 2nd position
of each file. I can't seem to get my loop to work quite
right.

TIA
 
* "Newbie said:
I'm trying to rename 2000+ jpg files in a directory. all
filenames are similar, so that makes it a little bit
easier. They look like at123456a, at123457a, etc.

What I need to do is delete the "t" in the 2nd position
of each file. I can't seem to get my loop to work quite
right.

'Microsoft.VisualBasic.Rename' or 'File.Move'.
 
Below is my code, but it isn't working.

Dim files As String
Dim i As Integer
Dim count As Integer

Me.FileListBox1.Path = "C:\jpgs\"
count = Me.FileListBox1.Items.Count
files = Me.FileListBox1.FileName

For i = 0 To count - 1
System.IO.File.Move(Me.FileListBox1.Items
(i).ToString, & Me.FileListBox1.Items(i).Replace("t", ""))

Next

End Sub
 
Back
Top