User Tools

Site Tools


rename_change_file_directory_name_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== RENAME (change file directory name) ====== Previous pageReturn to chapter overviewNext page

RENAME(file,new file)

blk2blue.jpg

RENAME Renames a FILE.
file The label of a FILE to rename, or a string constant or variable containing a file specification.
new file A string constant or variable containing a file specification. If the file specification does not contain a drive and path, the current drive and directory are assumed. If only the path is specified, the filename and extension of the original file are used for the new file. Files cannot be renamed to a new drive.

The RENAME statement changes the file specification to the specification for the new file in the directory. The file to rename must be closed, or the “File Already Open” error is posted. If the file specification of the new file is identical to the original file, the RENAME statement is ignored. If any error is posted, the file is not renamed.

Since some file drivers use multiple physical disk files for one logical FILE structure, the default filename and extension assumptions are dependent on the file driver.

Errors Posted:

02 File Not Found
03 Path Not Found
05 Access Denied
52 File Already Open

Example:

RENAME(Text,'text.bak')                      !Make it the backup

RENAME(Master,'\newdir')                     !Move it to another directory

RENAME('C:\AUTOEXEC.BAT','C:\AUTOEXEC.SAV')  !Make it the backup

See Also:

CLOSE

rename_change_file_directory_name_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1