473,396 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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?

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #1
3 1782
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

"Erik Foreman" <Er**@devedx.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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?

*** Sent via Developersdex http://www.developersdex.com ***

Nov 21 '05 #2
what is the rename function??
Regards
"Erik Foreman" <Er**@devedx.com> wrote in message
news:#g**************@TK2MSFTNGP10.phx.gbl...
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?

*** Sent via Developersdex http://www.developersdex.com ***

Nov 21 '05 #3
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.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: C-man | last post by:
Basically I have this little program that will look through directories and rename any file it finds. The renaming that takes place is like removing of dashes or Caps the first letter from each...
3
by: fanbanlo | last post by:
C:\MP3\001.txt -> 0.txt C:\MP3\01. ??? - ????(???).mp3 -> 1.mp3 Traceback (most recent call last): File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in...
16
by: dudufigueiredo | last post by:
I have one folder containing mp3 files, the folder is: C:\My Shared Folder\Rubber Soul And the files are: 01 drive my car.mp3 02 norwegian wood.mp3 03 you won't see me.mp3 04 nowhere man.mp3...
9
by: _DD | last post by:
Is there any easy way to rename an entire project? I'd like to change everything: folder, sln file, etc.
6
by: 2112 | last post by:
I'm compiling a dll that imports msado15.dll. When I'm using Windows in English, the msado15.dll is located at <drive>:\Program Files\Common Files\System\ADO\msado15.dll". When using Windows in...
3
by: Luciano | last post by:
I have been programing in PHP recently. For this reason, I have lots of basic doubts. Let's see one of then. I'm developing in the localhost, so safety issues are not important. I have a script...
0
by: Bomac8 | last post by:
I have a text file with "|" as a delimeter with three (3) fields XXX-12345|\\YYYYYYY|\\ZZZZZZZZ I need to read these files into an output folder. The problem that I'm having is that I need to...
6
by: Pep | last post by:
Firstly, I'm not sure if this is the right group for this query, so please forgive me if I am wrong. My problem is that most users I distribute my software to cannot install it on their systems...
9
by: Keith G Hicks | last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher" project. Starting and stopping the watcher and reading my XML file work fine. Once the watcher is started, I'm reading...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.