I have to rename approx 600 files with a prefix in a number of folders. what is the best way to do this?
surely opening the files and then saving the files with a new name will take too long ?
Is there a funky VB function that i can use to carry out this change to every file in chosen folders ?
It’s this or a lot of ……F2…..Home…..Ctrl+V……enter …….. repeat !
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
rename all files in folder (vb6 or vba)
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » rename all files in folder (vb6 or vba)
- This topic has 6 replies, 5 voices, and was last updated 23 years, 9 months ago.
AuthorTopicWSfatherjack
AskWoody LoungerAugust 7, 2001 at 12:01 pm #358842Viewing 3 reply threadsAuthorReplies-
WSVBNerd
AskWoody Lounger -
WSAndrew Cronnolly
AskWoody Lounger -
WSfatherjack
AskWoody Lounger
-
-
WSRuff_Hi
AskWoody LoungerAugust 7, 2001 at 3:16 pm #536402try …
Dim i As Integer
Dim fso As Object
Dim lsFileName As String
Dim lvFile As Variant
Dim lsPath As String
Dim lsNewFileName As StringSet fso = CreateObject(“Scripting.FileSystemObject”)
lsPath = “C:Directory
lsFileName = Dir(lsPath & “*.*”)
If Not lsFileName = “” Then
lsNewFileName = ‘formula based renaming method’ End IfDo Until lsFileName = “” ‘ get the file and copy it
Set lvFile = fso.getfile(lsPath & lsFileName)‘ rename file
lvFile.Name = lsNewFileName‘ get next file name
lsFileName = Dir
If Not lsFileName = “” Then
lsNewFileName = ‘formula based renaming method’
End If
Loop -
WSjscher2000
AskWoody LoungerAugust 7, 2001 at 8:54 pm #536446I have adopted a file naming convention for my group where we name files with the data at the beginning, such as “99-01-01 blah.doc”. This created an interesting “Y2K” problem for me, since I wanted the 99 files to sort before the 2000 files. So I wrote a procedure to rename all of the files with a 19 prefix. It included a UserForm interface to drill down through your folder structure to find a target folder, and the option to include all of its subfolders. You will need to make some adjustments in the criteria, but hopefully this will give you a headstart.
-
WSfatherjack
AskWoody Lounger
-
Viewing 3 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Lumma malware takedown
by
EyesOnWindows
5 hours, 25 minutes ago -
“kill switches” found in Chinese made power inverters
by
Alex5723
6 hours, 59 minutes ago -
Windows 11 – InControl vs pausing Windows updates
by
Kathy Stevens
6 hours, 53 minutes ago -
Meet Gemini in Chrome
by
Alex5723
10 hours, 58 minutes ago -
DuckDuckGo’s Duck.ai added GPT-4o mini
by
Alex5723
11 hours, 7 minutes ago -
Trump signs Take It Down Act
by
Alex5723
19 hours, 5 minutes ago -
Do you have a maintenance window?
by
Susan Bradley
6 hours, 15 minutes ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
6 hours, 47 minutes ago -
Cox Communications and Charter Communications to merge
by
not so anon
22 hours, 25 minutes ago -
Help with WD usb driver on Windows 11
by
Tex265
1 day, 3 hours ago -
hibernate activation
by
e_belmont
1 day, 7 hours ago -
Red Hat Enterprise Linux 10 with AI assistant
by
Alex5723
1 day, 11 hours ago -
Windows 11 Insider Preview build 26200.5603 released to DEV
by
joep517
1 day, 14 hours ago -
Windows 11 Insider Preview build 26120.4151 (24H2) released to BETA
by
joep517
1 day, 14 hours ago -
Fixing Windows 24H2 failed KB5058411 install
by
Alex5723
10 hours, 18 minutes ago -
Out of band for Windows 10
by
Susan Bradley
1 day, 18 hours ago -
Giving UniGetUi a test run.
by
RetiredGeek
2 days, 1 hour ago -
Windows 11 Insider Preview Build 26100.4188 (24H2) released to Release Preview
by
joep517
2 days, 9 hours ago -
Microsoft is now putting quantum encryption in Windows builds
by
Alex5723
5 hours, 18 minutes ago -
Auto Time Zone Adjustment
by
wadeer
2 days, 14 hours ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
2 days, 11 hours ago -
Manage your browsing experience with Edge
by
Mary Branscombe
11 hours, 9 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
1 day, 4 hours ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
4 hours, 47 minutes ago -
Apps included with macOS
by
Will Fastie
1 day, 8 hours ago -
Xfinity home internet
by
MrJimPhelps
1 day, 5 hours ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
2 days, 7 hours ago -
Debian 12.11 released
by
Alex5723
3 days, 11 hours ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
3 days, 14 hours ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
2 days, 18 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.