|
ListFiles
array ListFiles(string
wildcard)
Return
Value
Returns array of records
describing each file listed according to the provided wildcard
mask. Attributes of the file can be
accessed as array elements at the following predefined
indexes:
array[N]["Name"] - string that specifies the name of
the file.
array[N]["Dir"] - boolean variable that is set to
TRUE if this record represents a directory.
array[N]["Size"] - integer variable that specifies
the file size in bytes.
array[N]["Time"] - integer variable that specifies
last file modification time in seconds since January 1st,
1970.
Parameters
wildcard
–
string
containing the name of the file to find or a wildcard
(*.*).
Remarks
Call this function to
search for a file(s) according to the specified wildcard mask.
Package
Plug in module:
nd_fileplg.npl
Example
The following
example demonstrates the use of ListFiles.
#
recursive disk folders traverse algorithm
string dir = "c:\"
string mask = "*.*"
string path
func list(string dir, string
mask)
string wildcard = dir +
mask
array files = ListFiles(wildcard)
array file
foreach(file in files)
if
(file["Dir"] == TRUE)
path = dir + file["Name"] +
"\"
Println(path)
list(path, mask)
endif
Println(dir, file["Name"])
endforeach
endfunc
list(dir, mask)
|