Unfortunately, FSO does not have a "renameFile()" method. However, there are two ways around this. The name property of the GetFile method is read / write, so you can do this:
<% set fso = CreateObject("Scripting.FileSystemObject") set file = fso.GetFile("c:\oldName.txt") file.name = "newName.txt" set file = nothing set fso = nothing %> |
You can also rename a file using FileSystemObject's MoveFile() method. Simply enter the old name and the new name as parameters, for example:
<% set fso = CreateObject("Scripting.FileSystemObject") fso.MoveFile "c:\oldname.txt", "c:\newname.txt" set fso = Nothing %> |
For more information on using FileSystemObject, including dozens of examples, see
Article #2039.