Desk likely to be a real drawer card

  • Thread starter Thread starter DIBS
  • Start date Start date
D

DIBS

What's the easiest way to rename all the files in a folder with entirely new
names starting with (say) 001?

The file type suffix to be retained as is.

Using VB2005 express edition.
 
DIBS said:
What's the easiest way to rename all the files in a folder with entirely
new names starting with (say) 001?

The file type suffix to be retained as is.

Using VB2005 express edition.

Untested:

\\\
Dim FileNames() As String = Directory.GetFiles("C:\Bla")
For i As Integer = 0 To UBound(FileNames)
Rename( _
FileNames(i), _
Path.Combine( _
Path.GetDirectoryName(FileNames(i)), _
i.ToString("0000") & Path.GetExtension(FileNames(i)) _
) _
)
Next i
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top