1. Home
  2. FRENAME directive

FRENAME directive

Renames files.

No options

Parameters

OLD = texts Name of each file to rename
NEW = texts New name for each file
OVERWRITE = string tokens Whether to overwrite any existing files (yes, no); default no

Description

FRENAMEallows you to rename external files. The names of the original files are specified, in texts, but the OLD parameter. The new file names are specified by the NEW parameter. If no path is included in the file name, it is assumed to be in the current working directory (which can be defined by the WORKINGDIRECTORY option of the SET directory). If you need to define the path, remember that the character \is the continuation symbol in Genstat. So this character needs to be duplicated in a string to avoid Genstat interpreting it as a continuation: for example

FRENAME 'Today.Dat'; NEW='D:\\April\\18.dat'

renames the file Today.dat to become the file 18.dat in the directory (or folder) D:\April. As a more convenient alternative, the PC version of Genstat allows you to use / instead: i.e. you could put

FRENAME 'Today.Dat'; NEW='D:/April/18.dat'

By default FRENAME gives a fault if there is already a file with the new name, but you can set parameter OVERWRITE=yes to overwrite it.

Options: none.

Parameters: OLD, NEW, OVERWRITE.

See also

Directives: FCOPY, FDELETE, CLOSE, ENQUIRE, OPEN.

Commands for: Input and output.

Updated on June 19, 2019

Was this article helpful?