Name
Renames a file on disk
Syntax
`
Declare Function Name( ByRef oldname As Const String, ByRef newname As Const String ) As Integer
`
Usage
`
result = Name( oldname, newname )
`
Parameters
`oldname`
Name of an existing file.
`newname`
New name of the file.
Return Value
Returns zero (0) on success and non-zero on failure.
Description
Renames a file or folder originally called `oldname` to `newname`.
Example
`
Dim OldName As String
Dim NewName As String
Dim result As Integer
OldName = "dsc001.jpg"
NewName = "landscape.jpg"
result = Name( OldName, NewName )
If 0 <> result Then
Print "error renaming " & oldname & " to " & newname & "."
End If
`
Differences from QB

- In QB, NAME required AS rather than a comma between the old and new names. This is because NAME was a language keyword rather than a function.

See also

- `Kill`