473,672 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

I am using a folderbrowserdi alog 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 1799
June 16, 2005

To loop through files one by one:

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

for each infoFile in infoDir.GetFile s ' 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.co m> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
I am using a folderbrowserdi alog 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.co m> wrote in message
news:#g******** ******@TK2MSFTN GP10.phx.gbl...
I am using a folderbrowserdi alog 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
1801
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 word and so on. Is there a better way to rename the files instead of creating a new file and calling originalFile.renameTo(new File(newFilename)); Basically I want to know if creating this new File each time will be costly in both memory and time...
3
4629
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 RunScript exec codeObject in __main__.__dict__ File "C:\MP3\!RenameNum.py", line 40, in ? renameFiles(os.path.dirname(sys.argv))
16
2975
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
8626
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
2278
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 Portuguese, the msado15.dll is located at <drive>:\Arquivos de programas\Arquivos comuns\System\ADO\msado15.dll I'd know if exists some preprocessor directive that could identify the language of Windows and import msado15.dll from the correct...
3
1840
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 trying to rename some local files, however, PHP reports an error. I don't have permission to access that folder, therefore, it's not possible to do this task. I'm using pHP as a module of Apache (Apache2Triad). The variable "open_basedir" in...
0
1331
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 create folders with the first part of the files (xxx-12345) and place the files \\YYYYYYY AND \\ZZZZZZZZ in this folder. Here is the code that I have so far.. Imports System.IO Public Class frmRedaction_Copier Inherits...
6
2032
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 due to not having the correct administrator rights. I'm perplexed over this as I cannot reasonably ask corporations to allow the local secretary to have admin or power user rights just to install my software. My software is intended for user...
9
2911
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 the text files from the watched folder line by line into variables and then posting them to a SQL table. All of the code for the form is shown below. And it works fine except for 2 issues. First issue: In the Finally of the Try for teh SQL...
0
8404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8828
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8608
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8680
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7446
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4418
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.