Progress
Language Reference


OS-COPY Statement

Interfaces
OS
SpeedScript
All
All
Yes

Executes an operating system file copy command from within Progress.

SYNTAX

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

source-filename

The name of the original file. If you specify a directory, OS-COPY generates an error.

VALUE ( expression )

An expression that returns the name of the original file. Expression can contain constants, field names, and variable names.

target-filename

The name of the new file or directory. If you specify a directory, OS-COPY gives the target file the same name as the source file.

VALUE ( expression )

An expression that returns the name of the new 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 copy. It then prompts for a name for the copy. Finally, the procedure uses the OS-COPY statement to copy the file.

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

Main:
REPEAT:
  SYSTEM-DIALOG GET-FILE sourcefilename
    TITLE  "Choose File to Copy"
    MUST-EXIST
    USE-FILENAME
    UPDATE OKpressed.

  IF OKpressed = FALSE THEN
    LEAVE Main.
  UPDATE copyfilename WITH FRAME copyframe.
  OS-COPY VALUE(sourcefilename) VALUE(copyfilename).
END. 

NOTES

SEE ALSO

OS-ERROR Function


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