Renames a file.
Name old$ As new$
Rename old$ As new$
old$, new$ | : sexp; old and new file names |
Name...As is synonymous with Rename...As, and both rename the specified file.
Dim old$ = "C:\TEST.DAT", new$ = "C:\TEST.TXT"
// Create "c:\test.dat"
BSave old$, 100000, 100
Print "Directory showing "; old$
Dir "c:\*.*"
// Rename "c:\test.dat" as "c:\test.txt"
If Exist(new$) Then Kill new$ (* If Test.txt exists, Name will cause an error *)
Name old$ As new$
Print "Directory showing "; new$
Dir "c:\*.*"
// Change "c:\test.txt" back to "c:\test.date"
If Exist(old$) Then Kill old$ (* If Test.txt exists, Rename will cause an error *)
Rename new$ As old$
Print "Directory showing "; old$
Dir "c:\*.*"
{Created by Sjouke Hamstra; Last updated: 11/07/2023 by James Gaite}