Skip to main content
Enumerates matching files and directories on a remote Windows device. Introduced in: RIT 0.0.14-preview.

Syntax

Parameters

remoteDevice
Type: const char*
The UTF-8 device name or IP address to contact. Resolve any saved default before calling this function. remoteFolderPath
Type: const char*
Optional UTF-8 directory path on the remote device. Null, empty, or . selects the common root. directoryOptions
Type: const WdRemoteDirectoryOptions*
Optional common-root, recursion, and metadata settings. Pass nullptr for defaults. searchOptions
Type: const WdRemoteDirectorySearchOptions*
Optional file and directory name/attribute filters. Pass nullptr for no filtering. callback
Type: WdRemoteDirectoryCallback
The required result or enumeration callback. See Remarks for continuation and lifetime rules. context
Type: void*
Optional caller-owned context passed unchanged to the callback. cancellationHandle
Type: WdCancellationHandle
A cancellation handle created with WdCreateCancellationHandle. Where optional, pass nullptr if cancellation isn’t needed.

Return value

Type: HRESULT Returns S_OK on success; otherwise returns a failure HRESULT. See Error codes.

Remarks

Entries are delivered in traversal-order batches, with UTF-8 paths relative to remoteFolderPath. The root itself isn’t reported; empty directories are reported. Copy entry data before the callback returns if it is needed later. A failed callback result stops processing and is returned as a failure. The call is synchronous. A null, empty, or . remote path selects the default or named common root. Absolute paths ignore the root alias. ${remoteEnv:NAME} references use the endpoint process environment. With null options, recursion is disabled and metadata isn’t requested. Use WdCancelRemoteDirectoryEnumeration from another thread to request cancellation. Keep the handle open until enumeration returns. Cancellation before work starts returns S_OK; after work starts, successful cancellation waits for endpoint acknowledgement. Entries already received form a partial listing. An endpoint without the required directory protocol returns WD_E_SERVERTOOOLD.

Requirements

See also

Last modified on November 25, 2026