creating a program to rename a group of files in a folder

  • Thread starter Thread starter Erik Foreman
  • Start date Start date
E

Erik Foreman

I am using a folderbrowserdialog object to prowse to a folder then once
in that folder I am going to have my program rename all of the files in
that folder. I know the rename funchtion but I am not sure how to get
the program to loop through each file in the folder so they all get
renamed in a certian sequence. can someone help me?
 
June 16, 2005

To loop through files one by one:

dim infoDir as new io.directoryinfo(filepath)
dim infoFile as fileinfo
dim i as integer ' used as a counter for how many files iterated

for each infoFile in infoDir.GetFiles ' Loops through each file info in
GetFiles

' Rename here
i += 1
next

You could use something like this to loop through the files. I hope this
helps and have a great day!
--
Joseph Bittman
Microsoft Certified Application Developer

Web Site: http://71.35.110.42
Dynamic IP -- Check here for future changes
 
Joseph Bittman MCAD I must say thank you. That was great. Everything I
needed. I hope to some day be MCAD as well.

as far as the other reply asking what is the rename function it is
simple:

rename(oldname, newname)

be aware you may need to have the path in along with the file name.
 
Back
Top