[AccessD] Rename All Files In A Folder

paul.hartland at fsmail.net paul.hartland at fsmail.net
Thu Apr 17 08:41:59 CDT 2008


Yes, that's virtually spot on to what I done when I clicked the send button lol, the send button almost seems magical at times....





Message Received: Apr 17 2008, 02:24 PM
From: "Heenan, Lambert" 
To: "'Access Developers discussion and problem solving'" 
Cc: 
Subject: Re: [AccessD] Rename All Files In A Folder



Sub RenameFiles(strFolder as String,strFind as String,strReplace as String)

Dim strFile as String
Dim strNew as String
strFile = Dir(strFolder & "*.*")
While strFile & "" > ""
strNew = Relpace(strFile,strFind,strReplace)
if strFile <> strNew Then
Name strFolder & strFile, strFolder & strNew
End IF
strFile = Dir()
Wend
End Sub



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
paul.hartland at fsmail.net
Sent: Thursday, April 17, 2008 7:26 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Rename All Files In A Folder
Importance: High

Please ignore email about renaming, blonde moment came to an end......





Message Received: Apr 17 2008, 12:23 PM
From: paul.hartland at fsmail.net
To: "accessd" 
Cc: 
Subject: [AccessD] Rename All Files In A Folder

To all,

Sorry about the post, I am sure that I have done this before and is simple
but having a blonde day today (no offence to any blondes out there).....I
want a function so that I can pass a folder location and two strings to,
then the function to rename all the files that contain stringA in them to
stringB. For example say I have a folder called staff, and inside that
folder contained a file called 999999_ThisIsAnExample. I want to pass Staff,
999999, 999998 to the function so that 999999_ThisIsAnExample would become
999998_ThisIsAnExample and do the same with any other file in that folder
that had a 999999 in the filename.

Thanks in advance for any help on this.


Paul Hartland
paul.hartland at fsmail.net
07730 523179
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





Paul Hartland
paul.hartland at fsmail.net
07730 523179
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





Paul Hartland
paul.hartland at fsmail.net
07730 523179


More information about the AccessD mailing list