How to list text files in a directory in Progress 4GL?
-
I have a folder in c drive,whicn contain 1000 txt file,i want to get the list of all these txt file. How can i get this list?
-
Answer:
Use the OS-DIR() function. For example: DEFINE STREAM dirlist. DEFINE VARIABLE filename AS CHARACTER FORMAT "x(30)" NO-UNDO. INPUT STREAM dirlist FROM OS-DIR("."). REPEAT: IMPORT STREAM dirlist filename. DISPLAY filename. END. INPUT CLOSE.
Jay at Stack Overflow Visit the source
Other answers
For example: ipcPath = "C:\temp\ DEFINE INPUT PARAMETER ipcPath AS CHARACTER NO-UNDO. DEFINE VARIABLE chFiles AS CHARACTER NO-UNDO. INPUT FROM OS-DIR(ipcPath). REPEAT: IMPORT UNFORMATTED chImport NO-ERROR. DISPLAY chFiles FORMAT "X(75)". END. INPUT CLOSE. chFiles is a spacedelimeted list and contains the filename, the path, and an 'F' or 'D' tag.
Demian Kasier
I have a directory-tools program which enable a developer to do all kinds of fun things with file systems. You can get the code here: http://communities.progress.com/pcom/docs/DOC-16578
Tim Kuehn
Related Q & A:
- How to write temporary files from temporary path to a temporary directory?Best solution by msdn.microsoft.com
- How do you save files to a cd?Best solution by cws.gtc.edu
- How to overwrite multiple files in a directory?Best solution by Stack Overflow
- How to recover deleted files on a JVC Everio Camcorder hard drive?Best solution by answers.yahoo.com
- How do you transfer files from a dead computer to an external hard drive?Best solution by pcworld.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.