|Powered by QM on a Linux server|
KnowledgeBase 00051: The DIR() Function
The DIR() function allows an application to process an operating system directory.
Using the DIR() Function
The syntax of this function is
LIST = DIR(PATHNAME)where PATHNAME is the operating system pathname of the directory to be processed.
The returned value from this function, stored in LIST in the above example, is a dynamic array in which there is a field for each item in the directory. The values in each field are
A Simple Directory Listing Program
s = dir(".") n = dcount(s, @fm) for i = 1 to n display s<i,2> : ' ' : oconv(s<i,4>, 'EDMYTSL[,A3]') : ' ' : s<i,1> next iUse of this program might produce output as below.
D 11 Nov 2011 13:57:21 $COMO D 24 Oct 2011 14:02:00 $HOLD D 21 Jun 2010 20:40:15 $HOLD.DIC D 24 Oct 2011 14:02:00 $SVLISTS F 18 Oct 2011 14:42:29 AUDIT.LOG F 23 Nov 2011 10:58:23 errlog