VB6Parse / Library / File Operations / name

VB6 Library Reference

Name Statement

Renames a disk file, directory, or folder.

Syntax

Name oldpathname As newpathname

Remarks

Examples

' Rename a file
Name "OLDFILE.TXT" As "NEWFILE.TXT"
' Move and rename a file
Name "C:\Data\Report.doc" As "C:\Archive\OldReport.doc"
' Rename a directory
Name "C:\OldFolder" As "C:\NewFolder"
' Move file to different directory (same drive)
Name "C:\Temp\Test.dat" As "C:\Data\Test.dat"
' Using variables
Dim oldName As String, newName As String
oldName = "File1.txt"
newName = "File2.txt"
Name oldName As newName

Reference

Name Statement - Microsoft Docs

← Back to File Operations | View all statements