You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Commands: GetDirectoriesAsync

The GetDirectoriesAsync method is designated to retrieve the paths of subdirectories of a specified directory.

Syntax

Task<string[]> GetDirectoriesAsync(string from = null, int start = 0, int pageSize = 1024);

Parameters
from string The directory path (default: null means the root directory)
start int The number of results that should be skipped (for paging purposes)
pageSize int The max number of results to get

Return Value
Task<string[]> A task that represents the asynchronous operation. The task result is the array of subdirectory paths.

Example

await store.AsyncFilesCommands.UploadAsync("text-files/txt/a.txt", content);
await store.AsyncFilesCommands.UploadAsync("text-files/doc/a.doc", content);
await store.AsyncFilesCommands.UploadAsync("text-files/doc/drafts/a.doc", content);
await store.AsyncFilesCommands.UploadAsync("image-files/a.jpg", content);

string[] dirs;

dirs = await store.AsyncFilesCommands.GetDirectoriesAsync(); // will return "/image-files" and "/text-files"

dirs = await store.AsyncFilesCommands.GetDirectoriesAsync("/text-files"); // will return "/text-files/doc" and "/text-files/txt"

dirs = await store.AsyncFilesCommands.GetDirectoriesAsync("/image-files"); // will return empty array