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

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: