Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Renaming a file

Status
Not open for further replies.

mg911

Technical User
Jul 18, 2001
59
US
Is there a way to rename a file from 123.test 321.test
 
dim fileName, temp, letters(), i, newName
fileName = "123.test"
temp = split(fileName,".")
redim letters(len(temp(0))
i = ubound(letters)
do while i >= lbound(letters)
newName = newName & letters(i)
i = i - 1
loop
newName = newName & temp(1)

You'll need to use the fileSystemObject to both get the fileName (where I just assigned it up there), and then just copy the file with the newName as the new file name, and then delete the old one.

You can find all the information you need about the fileSystemObject at
Go to their vbScript area, and view index.

good luck! :)
Paul Prewett
penny.gif
penny.gif
 
sweet - thanks a lot

now is there a way to add a date or date and time to this file or is that notpossible

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top