Extended ADIR function. Stores information about files into an array, cursor or calls a callback function for each file.

ADirEx(cArrayName | cCursorName | cCallback, cFileSkeleton [, nFileFilter [, nFlags]])

Parameters

cArrayName | cCursorName | cCallback

The name of the array, cursor or callback function.

Structure of array
ColumnContentDatatype
1FilenameC
2Short filenameC
3Creation timeT
4Last access timeT
5Last write timeT
6FilesizeN
7AttributesN


If you specify ADIREX_DEST_CURSOR in the nFlags parameter and the cursor does not exist a cursor with of default fieldnames is created.

CREATE CURSOR theCursorName (filename C(254), dosfilename C(13), creationtime T, accesstime T, writetime T, filesize N(20,0), fileattribs I)

A self created cursor with alternate names or additional fields is also possible, but the fieldtypes and order of the above field's have to match.

If you specify ADIREX_DEST_CALLBACK in the nFlags parameter the function definition of the callback procedure has to match this one:

FUNCTION AdirExCallbackExample(cFileName,cDosFileName,tCreationTime,tLastAccessTime,tLastWriteTime,nFileSize,nFileAttributes)
ENDFUNC
cFileSkeleton

Fully qualified (drive:\path\wildcard) search string e.g. "C:\Winnt\*.dll"

nFileFilter (additive)

Additionaly filter files by attributes, the type of filtering is controlled by the nFlags parameter.

0 or ommited -> filter is not used

e.g.
FILE_ATTRIBUTE_DIRECTORY - only directories will be enumerated

there's also a special flag
FILE_ATTRIBUTE_FAKEDIRECTORY - if you specify it the "fake" directories "." & ".." will also be listed .. by default they are not listed

nFlags (additive)

The nFlags parameter controls three behaviours of the function:

1. specifies the meaning of parameter 1
ADIREX_DEST_ARRAY - the files are stored into the arrayname passed
ADIREX_DEST_CURSOR - the files are stored into the cursorname passed
ADIREX_DEST_CALLBACK - the functionname passed is called back for each found file

2. the behaviour of filtering that is applied:
by default at least one of the specified attributes passed in nFileFilter have to be set for a match:
ADIREX_FILTER_ALL - all attributes have to be set for a match
ADIREX_FILTER_NONE - none of the attributes have to be set for a match
ADIREX_FILTER_EXACT - the value returned by GetFileAttributes must be exactly the same as the supplied filter

3. filetime conversion:
By default filetimes are converted to the local timezone,
but if you specify ADIREX_UTC_TIMES filetimes are returned as UTC (GMT) times.

Return Value

The number of files / directories.

See Also

Reference

ADirectoryInfo
ADriveInfo
AFileAttributes
AFileAttributesEx
CancelFileChange
CompareFileTimes
CopyFileEx
DeleteDirectory
DeleteFileEx
FindFileChange
GetFileAttributes
GetFileOwner
GetFileSize
GetFileTimes
GetLongPathName
GetShortPathName
MoveFileEx
SetFileAttributes
SetFileTimes

Used WinApi functions

FindFirstFile
FindNextFile
FindClose