Hello Peggers
I'm working on an application that imports files from a directory (eventually also subdirectories).
Some of the files will be converted to one or more files in that same directory and should also be imported.
We used the following code (simplified) for this:
DEFINE VARIABLE cImportDir AS CHARACTER NO-UNDO.
RUN find-file (cImportDir).
PROCEDURE find-file :
DEFINE INPUT PARAMETER cDir AS CHARACTER NO-UNDO.
DEFINE VARIABLE c1 AS CHARACTER NO-UNDO. /*file name*/
DEFINE VARIABLE c2 AS CHARACTER NO-UNDO. /*file name with path*/
DEFINE VARIABLE c3 AS CHARACTER NO-UNDO. /*file type*/
INPUT FROM OS-DIR(cDir).
REPEAT:
IMPORT c1 c2 c3.
IF c1 = "." OR c1 = ".." THEN NEXT.
IF INDEX(c3, "D":U) = 1 THEN RUN find-file(c2).
IF INDEX(c3, "F":U) > 0 THEN RUN conversion(c2).
END.
INPUT CLOSE.
END PROCEDURE.
The procedure conversion checks the file and creates new file(s) in the same directory, and removes the original file.
Now this code seems to work when there is more then 3-4 files in the directory already. However when there is for example only one file in the directory, then the new file is not processed.
Does anybody have an explanation for this behaviour and if possible a way so that the procedure will process all files in the directory including the new ones?
We work with Progress 8.3b on windows 95/98.
I'm working on an application that imports files from a directory (eventually also subdirectories).
Some of the files will be converted to one or more files in that same directory and should also be imported.
We used the following code (simplified) for this:
DEFINE VARIABLE cImportDir AS CHARACTER NO-UNDO.
RUN find-file (cImportDir).
PROCEDURE find-file :
DEFINE INPUT PARAMETER cDir AS CHARACTER NO-UNDO.
DEFINE VARIABLE c1 AS CHARACTER NO-UNDO. /*file name*/
DEFINE VARIABLE c2 AS CHARACTER NO-UNDO. /*file name with path*/
DEFINE VARIABLE c3 AS CHARACTER NO-UNDO. /*file type*/
INPUT FROM OS-DIR(cDir).
REPEAT:
IMPORT c1 c2 c3.
IF c1 = "." OR c1 = ".." THEN NEXT.
IF INDEX(c3, "D":U) = 1 THEN RUN find-file(c2).
IF INDEX(c3, "F":U) > 0 THEN RUN conversion(c2).
END.
INPUT CLOSE.
END PROCEDURE.
The procedure conversion checks the file and creates new file(s) in the same directory, and removes the original file.
Now this code seems to work when there is more then 3-4 files in the directory already. However when there is for example only one file in the directory, then the new file is not processed.
Does anybody have an explanation for this behaviour and if possible a way so that the procedure will process all files in the directory including the new ones?
We work with Progress 8.3b on windows 95/98.