Kbase P125683: ABL/4GL: How to list the names of all files having a given extension in a directory?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  30/08/2007 |
|
Status: Unverified
GOAL:
ABL/4GL: How to list the names of all files having a given extension in a directory?
GOAL:
ABL/4GL: How to list all Microsoft EXCEL file names in a given directory?
FACT(s) (Environment):
All Supported Operating Systems
OpenEdge Category: Language (4GL/ABL)
Progress 8.x
Progress 9.x
OpenEdge 10.x
FIX:
The following code displays the names of all files having the .xls extension in the given directory:
DEFINE VARIABLE cCurrentDiretory AS CHARACTER NO-UNDO.
DEFINE VARIABLE cCurrentFile AS CHARACTER NO-UNDO.
DEFINE VARIABLE cExtension AS CHARACTER NO-UNDO.
DEFINE STREAM myStream.
ASSIGN
cCurrentDiretory = "C:\Documents and Settings\yshanshi\My Documents"
cExtension = "xls".
INPUT STREAM myStream FROM OS-DIR( cCurrentDiretory).
REPEAT:
IMPORT STREAM myStream cCurrentFile.
IF LENGTH(cCurrentFile) < 3 THEN NEXT.
IF cCurrentFile MATCHES "*~~." + cExtension THEN
DISPLAY cCurrentFile FORMAT "x(60)".
END.
INPUT STREAM myStream CLOSE.