Click or drag to resize

InventoryLegacyInventoryDirectory Method

For a given directory path (folder), very quickly discovers all sub-directories and all files (documents) under this path.

Namespace: OpenDiscoverSDK.Platform.Inventory.Legacy
Assembly: OpenDiscoverSDK (in OpenDiscoverSDK.dll) Version: 2025.4.4.0 (2025.4.4)
Syntax
C#
public static InventoryResult InventoryDirectory(
	string directoryPath,
	InventoryMode mode = InventoryMode.DirectoriesAndDocuments,
	bool wantFileOwner = false
)

Parameters

directoryPath  String
The path of the directory to discover.
mode  InventoryMode  (Optional)
Optional InventoryMode argument. By default (DirectoriesAndDocuments) the input directory and all sub-directories nested under input directory get enumerated along with their corresponding file system metadata. Additonally, all file in and nested under input directory get enumerated along with their corresponding file system metadata. For DirectoriesOnly the input directory and all sub-directories nested under input directory get enumerated along with their corresponding file system metadata; However, files are not enumerated and returned but the number of total files and total file size under a directory is returned as directory metadata (see TotalDocumentCount and TotalSizeInBytes). If true, the file system owner name will be returned for each directory (default is false, files are not checked for owner). It is not recommended to select getting file system owner unless the user intends to make use of it as it drastically reduces performance.
wantFileOwner  Boolean  (Optional)

[Missing <param name="wantFileOwner"/> documentation for "M:OpenDiscoverSDK.Platform.Inventory.Legacy.InventoryLegacy.InventoryDirectory(System.String,OpenDiscoverSDK.Interfaces.Platform.Inventory.Legacy.InventoryMode,System.Boolean)"]

Return Value

InventoryResult
An InventoryResult object that contains information on the input directory, all sub-directories, and all files (documents) contained in those directories.
Remarks

This is a synchronous method and supports long file paths greater than MAX_PATH, or 260 characters.

This method enumerates (inventories) all sub-directories and files under the 'directoryPath' argument. After enumeration, all files and their file system attributes and all sub-directories and their file system attributes are known and can be accessed through property Root of the returned InventoryResult object.

Also, a list of all documents (files) contained under the 'directoryPath' argument (including its sub-directories) can be accessed through Documents of the returned InventoryResult object.

See Also