RenameFile()

Syntax

Result = RenameFile(OldFilename$, NewFilename$)
Description
Rename the old file to the new file. If the Result is 0, the rename has failed.

Its even possible to rename directory names, just use the related path with directory name.

Example:
  RenameFile("C:\Temp\Test.txt", "C:\Temp\TestNew.txt")    ; renaming the Test file in Temp directory
  RenameFile("C:\Temp\", "C:\TempNew\")                    ; renaming the Temp directory itself
By using two different directories (and even drives) as parameter it's possible to even move a file.

Example:
  If RenameFile("C:\test.txt", "D:\temp\test_backup.txt")   
    Debug "Moving and renaming successful."    ; Moving and renaming of the file was successful
  Else 
    Debug "Moving and renaming failed."        ; Moving and renaming failed, e.g. because of a not found source file
  EndIf

Supported OS

All

<- NextDirectoryEntry() - FileSystem Index - SetCurrentDirectory() ->