Section contents
cfile.oxh
Use this class to scan a directory structure. The scan moves from directory to directory through the hierarchy, returning a list of the entries contained in each. The order in which the directories are scanned is determined by a sort key which is specified when setting up the scan. The base directory to be scanned and the entry types of interest must also be specified before performing the scan.
DeleteDirScan:(BYREF this&)
Destroys the directory scan object.
BYREF this& |
A handle to a directory scan object |
DirScanNew:(fs&)
Use this function to construct and allocate memory for a new DirScan object.
fs& |
A handle to a file system object |
If the object could not be created then an error is generated
which should be trapped by an ONERR
handler.
path$ = DirScanAbbreviatedPath$:(this&)
Use this function to get the abbreviated path of the entry currently being scanned. The abbreviated path is the path relative to the top level directory in the scan.
this& |
A handle to a directory scan object |
scanList& |
On return, contains filtered entries from the next directory in the structure. Returns NULL when all entries in the structure have been scanned. |
path& |
The abbreviated path of the entry currently being scanned. |
path$ = DirScanFullPath$:(this&)
Use this function to get the full path of the entry currently being scanned. The full path is the absolute path, including the drive letter.
this& |
A handle to a directory scan object |
scanList& |
On return, contains filtered entries from the next directory in the structure. Returns NULL when all entries in the structure have been scanned. |
path& |
The absolute path of the entry currently being scanned.. |
DirScanNext:(this&,BYREF dirList&)
Use this function to move to the next directory entry in the structure. The order in which the structure is scanned is determined by the scan direction and the entry sort mask which are specified when setting up the scan. The type of entries returned by this function is determined by the entry attribute mask also specified when setting up the scan.
this& |
A handle to a directory scan object |
scanList& |
On return, contains filtered entries from the next directory in the structure. Returns NULL when all entries in the structure have been scanned. |
If the next directory cannot be created then an error is
generated which should be trapped by an ONERR
handler.
DirScanSetScanData:(this&,name$,attMask&,sortMask&,scanDirection%)
Use this function to set up the scan. This involves specifying the directory at the top of the structure to be scanned, a filter for the entry types of interest, the order in which the entries in each directory in the structure are to be sorted and the scan direction.
Whether the scan direction is upwards or downwards, the directories which are scanned are those in the part of the hierarchy below the directory specified in aMatchName. By default, the scan direction is downwards. If the scan direction is set to KDirScanScanUpTree, all branches of the tree are explored starting at the lowest level directory in the tree below aMatchName, and ending at aMatchName. This option is provided for deleting a directory structure.
this& |
A handle to a directory scan object |
name$ |
The top level directory for the scan. Any path components which are not specified here will be taken from the session path. |
attMask& |
A bit mask which filters the entry types which should be returned by NextL(). The mask works as follows. To match files only, specify KEntryAttNormal&. To match both files and directories, specify KEntryAttDir&. To match directories only, specify KEntryAttDir& OR KEntryAttMatchExclusive&. To match files with a specific attribute, OR the attribute involved with KEntryAttMatchExclusive&. For example, to match read-only files, specify KEntryAttReadOnly& OR KEntryAttMatchExclusive&. See File or directory attributes for a full list of the attributes supported. |
sortMask& |
The order in which the directories are scanned by NextL(). For a list of the sort keys available, see Order of directory entries |
scanDirection% |
The direction of the scan. |
If the scan data cannot be created then an error is generated
which should be trapped by an ONERR
handler.
KDirScanUpTree% |
Scan upwards from the lowest level directory in the hierarchy to the top level directory |
KDirScanDownTree% |
Scan downwards from the top level directory in the hierarchy to the bottom level directory |