These tasks help access and manage a directory:
Directory handles can be permanent or temporary. A temporary handle is deleted as soon as the process that allocated the handle terminates. Permanent handles persist until the connection is closed or a process specifically deallocates them.
Separate functions allocate temporary and permanent directory handles:
Call NWDeallocateDirectoryHandle to deallocate a directory handle. It is especially important to deallocate permanent handles since they can remain after your application terminates.
A pair of functions read and modify the file path associated with a directory handle:
Many functions allow you to combine a path with a directory handle to specify a file or directory. If the directory handle parameter is a nonzero value, these functions generally interpret the path relative to the directory associated with the handle. Including a directory handle with a file operation can reduce the amount of space required to store the path variable.
File System Services provide access to directory entry information in the DOS name space. (Name Space Services provide access to entry information in other name spaces.) A pair of functions read and set directory entry information:
NWIntScanDirEntryInfo reads directory entry information.
NWSetDirEntryInfo modifies directory entry information.
These functions operate on NetWare® 3.11 and above only. They use three structures to pass directory entry information across the NetWare interface: NWENTRY_INFO, NWFILE_INFO, and NWDIR_INFO.
The following code calls NWSetDirEntryInfo to return some information about either a file or a directory. The command line supplies the directory path and search string, and also indicates whether to scan for files or directories. For example, if you want file directory entry information and PROG is the name of the executable, FS1 is the server, DIR1 is the directory, and *.* is the search string for files, the command line would be:
PROG FS1:\DIR1 *.*
If you want directory information the command line would be:
PROG FS1:\DIR1 * /d
NWParseNetWarePath finds the connection handle, and NWAllocTemporaryDirectoryHandle gets a directory handle to the input path. NWSetDirEntryInfo is then called until it returns an error. Results are displayed for each entry found. The inherited rights mask is shown for directories, and the file attributes are shown for files.