filespec - string specification for files to find. The specification must be consistent with the operating system being used and may include wildcard characters. A file specification may include path specifications, both full and partial.
subdirs - a boolean as to whether or not to include subdirectories in file search. The default is false, which limits the search for filespec to the current directory.
includeAttr - specify the file attributes to include in the file search. Only files with one of the attributes specified will be included in the array of file names and information retrieved. Attribute flags that do not apply to an operating system are ignored. If includeAttr is 0, only files with no attributes are included. The default value is:
File attributes are set using the following values:
FATTR_RDONLY Read-only file
FATTR_HIDDEN Hidden file
FATTR_SYSTEM System file
FATTR_ARCHIVE Archive file
More than one file attribute can be specified by using the bitwise or operator, "|". For example, to find files with the hidden or system attributes set, use the following expression:
FATTR_HIDDEN | FATTR_SYSTEM
A file attribute may be excluded from array of files returned by using the bitwise not operator, "~". For example, to exclude subdirectories, use the following expression:
requireAttr - specify attributes that files are required to have to be included in the array of file names and information retrieved. Files must have at least these attributes. The difference between the two file attributes specifications is that files must have at least one of the attributes specified by includeAttr but must have all the attributes specified by requireAttr. The default value is 0.
array - an array of objects with information about the file names retrieved. If no files or directories match the specifications of the parameters, a null is returned. Each element of the array has the following properties:
.name Full file name, including filespec path.
.attrib File flags, as defined in IncAttr, number.
.size Size of file, number in bytes, number.
.access Date and time of last file access, number.
.write Date and time of last write, number.
.create Date and time of file creation, number.
For example, if you use the following line of code:
var FileList = SElib.directory("*.*");
The information for the first file retrieved is accessed using:
The information for the second file is accessed using:
Find files in a directory
or subtree that match path and file specifications and have specified file attributes set. Remember the directory names are treated like file names and have the FATTR_SUBDIR attribute set. Matching files and information about them are retrieved and returned in an array of objects. These objects are also structures.
This method may be used in many ways. One way, besides the obvious way of getting information about files, is to test for the existence of a file or file specification. If the file specified does not exist, the return is null.
// The following routine lists
// all files matching FileSpec,
// except subdirectory entries,
// in the current directory of a script.
var FileList = SElib.directory(FileSpec, False,
if (null == FileList)
"No files found for search spec \"%s\".\n",
var FileCount = getArrayLength(FileList);
for (var i = 0; i < FileCount; i++)
"%s\tsize = %d\tCreate date/time = %s\n",