Progress
Language Reference


OS-RENAME Statement

Interfaces
OS
SpeedScript
All
All
Yes

Executes an operating system file rename or directory rename command from within Progress.

SYNTAX

OS-RENAME
  { source-filename | VALUE ( expression ) }
  { target-filename | VALUE ( expression ) } 

source-filename

The name of the file or directory to rename.

VALUE ( expression )

An expression that returns the name of the file or directory to rename. expression can contain constants, field names, and variable names.

target-filename

The new name of the file or directory.

VALUE ( expression )

An expression that returns the new name of the file or directory. expression can contain constants, field names, and variable names.

EXAMPLE

This procedure opens a dialog box that prompts the user to choose a file to rename. It then prompts for a new name. Finally, the procedure uses the OS-RENAME statement to rename the file.

r-os-nam.p
DEFINE VARIABLE sourcefile AS CHARACTER NO-UNDO.
DEFINE VARIABLE targetfile AS CHARACTER FORMAT "x(20)" VIEW-AS FILL-IN.
DEFINE VARIABLE OKpressed AS LOGICAL INITIAL TRUE.

Main:
REPEAT:

  SYSTEM-DIALOG GET-FILE sourcefile
    TITLE "Choose a File or Directory to Rename"
    MUST-EXIST
    USE-FILENAME
    UPDATE OKpressed.

  IF OKpressed = FALSE THEN
    LEAVE Main.
  UPDATE targetfile WITH FRAME newnameframe.
  OS-RENAME VALUE(sourcefile) VALUE(targetfile).
END. 

NOTES

SEE ALSO

OS-ERROR Function


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095