Equinox Online Help - Language Reference - A to Z

Home

FileRename

Applies to
SyntaxFileRename SourceExpression, TargetExpression
Action[Statement] Renames or moves a file
ScopeUsable anywhere
Notes

This statement renames or moves a file with the name and path specified by SourceExpression to a new name and path specified by TargetExpression. Drive letters can be included in the path, but files cannot be moved from one drive to another. SysError is set to non-zero if the path or name was invalid or the user had insufficient rights.

The system workarea SysError is set to a non-zero value if an error occurs, otherwise zero.

CategoryFile Management
See Also ChooseFile, FileDelete, FileDetails, FileExists, FileHandle, FilePath, FileRename, FileSearch, FileSearchNext, MakeDirectory, RemoveDirectory
Example

This line renames a file in the current directory.

FileRename "MYFILE.DAT", "MYFILE2.DAT"

This line moves a file.

FileRename "TEST\MYFILE", "\ARCHIVE\MYFILE"