Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>directory()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DIRECTORY()
 Create an array of directory and file information
------------------------------------------------------------------------------
 Syntax

     DIRECTORY(<cDirSpec>, [<cAttributes>]) --> aDirectory

 Arguments

     <cDirSpec> identifies the drive, directory and file specification
     for the directory search.  Wildcards are allowed in the file
     specification.  If <cDirSpec> is omitted, the default value is *.*.

     <cAttributes> specifies inclusion of files with special attributes
     in the returned information.  <cAttributes> is a string containing one
     or more of the following characters:

     DIRECTORY() Attributes
     ------------------------------------------------------------------------
     Attribute    Meaning
     ------------------------------------------------------------------------
     H            Include hidden files
     S            Include system files
     D            Include directories
     V            Search for the DOS volume label and exclude all other files
     ------------------------------------------------------------------------

     Normal files are always included in the search, unless you specify V.

 Returns

     DIRECTORY() returns an array of subarrays, with each subarray containing
     information about each file matching <cDirSpec>.  The subarray has the
     following structure:

     DIRECTORY() Subarray Structure
     ------------------------------------------------------------------------
     Position     Metasymbol     Directry.ch
     ------------------------------------------------------------------------
     1            cName          F_NAME
     2            cSize          F_SIZE
     3            dDate          F_DATE
     4            cTime          F_TIME
     5            cAttributes    F_ATTR
     ------------------------------------------------------------------------

     If no files are found matching <cDirSpec> or if <cDirSpec> is an illegal
     path or file specification, DIRECTORY() returns an empty ({}) array.

 Description

     DIRECTORY() is an environment function that returns information about
     files in the current or specified directory.  It is similar to ADIR(),
     but returns a single array instead of adding values to a series of
     existing arrays passed by reference.

     Use DIRECTORY() to perform actions on groups of files.  In combination
     with AEVAL(), you can define a block that can be applied to all files
     matching the specified <cDirSpec>.

     The header file, Directry.ch, in the \CLIP53\INCLUDE subdirectory
     contains #defines for the subarray subscripts, so that the references to
     each file subarray are more readable.

 Examples

     .  This example creates an array of information about files in
        the current directory and then lists the names of the files using
        AEVAL() and QOUT():

        #include "Directry.ch"
        //
        aDirectory := DIRECTORY("*.*", "D")
        AEVAL( aDirectory, {|aFile| QOUT(aFile[F_NAME])} )

 Files   Library is CLIPPER.LIB, header file is Directry.ch.


See Also: AEVAL() CURDIR()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson