Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>adir()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ADIR()


Syntax:     ADIR(<directory skeleton> [,<array1> [,<array2> [,<array3>
            [,<array4> [, <array5>]]]]])

Purpose:    To fill a series of arrays with directory information
            including filenames and/or return the number of files
            matching a skeleton.

Arguments:  <directory skeleton> is a wildcard pattern of files that
            can include path.  The standard wildcard characters (* and
            ?) are supported.  The default is "*.*"

            <array1> is the name of the array to fill with the
            filenames matching the directory skeleton.  Each element is
            character type.

            <array2> is the array to fill with the sizes of the
            corresponding files in <array1>.  Each element is numeric
            type.

            <array3> is the array to fill with the dates of the
            corresponding files in <array1>.  Each element is date type.

            <array4> is the array to fill with the times of the
            corresponding files in <array1>.  Each element is character
            type.

            <array5> is the array to fill with attributes of the
            corresponding files in <array1>.  Each element is character
            type.  The possible values returned are as follows:


            Table: Attributes of Files Returned by ADIR()
            ----------------------------------------------
            Symbol      Description
            ----------------------------------------------
               R        Read only
               H        Hidden
               S        System
               D        Directory
               A        Archive
            ----------------------------------------------

            Note that if <array5> is specified, hidden, system, and
            directory files are included as well as normal files.  If
            <array5> is not specified only normal files are included.

Returns:    An integer numeric value.

            ADIR() returns the number of files matching the specified
            directory skeleton.  If optional arguments are specified,
            elements of each array are filled with file information--one
            file per element--until all matching files have been found
            or all of the elements have been used.

Usage:      ADIR() is useful as a tool for building file selectors and
            directory maintenance routines.  To create a file list
            array, you must DECLARE an array and then fill it with the
            necessary filenames.  The best way to do this is to first
            use ADIR() as the number of elements argument in the DECLARE
            statement.  For example:

            DECLARE dbf_files[ADIR("*.dbf")]

            Then sometime later, fill the array using the directory
            skeleton.

            To fill arrays for some attributes while ignoring others,
            pass a dummy variable.  For example, to obtain only the
            filenames and corresponding file dates:

            dbf_count = ADIR("*.dbf")
            DECLARE dbf_files[dbf_count], dbf_date[dbf_count]
            dummy = ""
            ADIR("*.dbf", dbf_file, dummy, dbf_date)

Library:    EXTEND.LIB


----------------------------------- Example --------------------------------

   DECLARE aray_dir[ADIR("*.txt")]
   ADIR("*.txt", aray_dir)


See Also: ACHOICE() ASCAN() ASORT() LEN()

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