DirInfoToArray

Returns information on a set of directories, as an array.

Syntax:

DirInfoToArray ( dir-list [, flags])

Parameters:

(s) dir-list specifies a set of sub-directory names, which may be wildcarded.

(i) flags [optional] can be set to 0, or can specify one or more of the following values combined with the bitwise OR ('|') operator:
Value
 Meaning
1 Return directory sizes as huge numbers. This is a long decimal number string, which may represent a number too large to be converted to an integer.

2 Return directory names with full paths

Returns:

(a)  2-dimension array

 

This function creates and returns a 2-dimension array. There are [n + 1] rows in the array, where 'n' is the number of directories that were returned. Each row has 7 columns. The first row (row 0) is a header containing summary information. Each subsequent row contains information about one returned directory. The columns are as follows:

 

Header row:

Column

Value

0

number of directories returned

1

total directory size. Note: Set to 0

2-6

(unused, set to 0)

 

Other rows:

Column

Value

0

directory name

1

directory size. Note: all sizes for directories will be 0.

2

directory last modified time, in YmdHms format

3

directory last accessed time, in YmdHms format

4

directory created time, in YmdHms format

5

directory attribute string in the form "RASH" (see DirAttrGet)

6

directory attribute bitmask (see DirAttrGetEx)

 

This function supports extended-length path names.

Example:


dirlist = StrCat(ShortCutDir("Personal",0,@TRUE),"*.*")
infoarray = DirInfoToArray(dirlist, 1|2)
infostr = StrCat("Number of directories: ",infoarray[0,0],@CRLF,@CRLF)
For xx = 1 To infoarray[0,0]
   infostr = StrCat(infostr,"Directory Name: ",infoarray[xx,0],@CRLF)
   ;Note that all sizes (column 1) for directories will be 0.
   infostr = StrCat(infostr,"Directory Size: ",infoarray[xx,1],@CRLF)
   infostr = StrCat(infostr,"Last Modified: ",infoarray[xx,2],@CRLF)
   infostr = StrCat(infostr,"Last Accessed: ",infoarray[xx,3],@CRLF)
   infostr = StrCat(infostr,"Created: ",infoarray[xx,4],@CRLF)
   infostr = StrCat(infostr,"Attribute: ",infoarray[xx,5],@CRLF)
   infostr = StrCat(infostr,"Attribute Bitmask: ",infoarray[xx,6],@CRLF)
   infostr = StrCat(infostr,@CRLF)
Next
tmpfile = FileCreateTemp("TMP")
FilePut(tmpfile,infostr)
AskFiletext("Directory Data",tmpfile,@UNSORTED,@SINGLE, @FALSE)
FileDelete(tmpfile)
Exit
See Also:

DirItemize, DirAttrGet, DirAttrGetEx, DirTimeGet, DirSize