devxlogo

Rename a file

Rename a file

Question:
In VB, how do you rename a file (at runtime)?

Answer:
Use the FileSystem object (Microsoft Scripting Runtime, SCRRUN.dll) as follows:

Dim fs As New FileSystemObjectDim f As FileSet f = fs.GetFile(Filename)f.Name = NewFileName

devx-admin

Share the Post: