ShareDirectoryClient.listFilesAndDirectories Method

Definition

Overloads

listFilesAndDirectories()

Lists all sub-directories and files in this directory without their prefix or maxResult in single page.

Code Samples

List all sub-directories and files in the account

shareDirectoryClient.listFilesAndDirectories().forEach(
     fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.",
         fileRef.isDirectory(), fileRef.getName())
 );

For more information, see the Azure Docs.

listFilesAndDirectories(ShareListFilesAndDirectoriesOptions options, Duration timeout, Context context)

Lists all sub-directories and files in this directory with their prefix or snapshots.

Code Samples

List all sub-directories and files in this directory with "subdir" prefix and return 10 results in the account

shareDirectoryClient.listFilesAndDirectories(new ShareListFilesAndDirectoriesOptions()
         .setPrefix("subdir").setMaxResultsPerPage(10), Duration.ofSeconds(1), new Context(key1, value1))
     .forEach(fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.",
         fileRef.isDirectory(), fileRef.getName()));

For more information, see the Azure Docs.

listFilesAndDirectories(String prefix, Integer maxResultsPerPage, Duration timeout, Context context)

Lists all sub-directories and files in this directory with their prefix or snapshots.

Code Samples

List all sub-directories and files in this directory with "subdir" prefix and return 10 results in the account

shareDirectoryClient.listFilesAndDirectories("subdir", 10, Duration.ofSeconds(1),
     new Context(key1, value1)).forEach(
         fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.",
             fileRef.isDirectory(), fileRef.getName())
 );

For more information, see the Azure Docs.

listFilesAndDirectories()

Lists all sub-directories and files in this directory without their prefix or maxResult in single page.

Code Samples

List all sub-directories and files in the account

shareDirectoryClient.listFilesAndDirectories().forEach(
     fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.",
         fileRef.isDirectory(), fileRef.getName())
 );

For more information, see the Azure Docs.

public PagedIterable<ShareFileItem> listFilesAndDirectories()

Returns

ShareFileItem in the storage directory

listFilesAndDirectories(ShareListFilesAndDirectoriesOptions options, Duration timeout, Context context)

Lists all sub-directories and files in this directory with their prefix or snapshots.

Code Samples

List all sub-directories and files in this directory with "subdir" prefix and return 10 results in the account

shareDirectoryClient.listFilesAndDirectories(new ShareListFilesAndDirectoriesOptions()
         .setPrefix("subdir").setMaxResultsPerPage(10), Duration.ofSeconds(1), new Context(key1, value1))
     .forEach(fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.",
         fileRef.isDirectory(), fileRef.getName()));

For more information, see the Azure Docs.

public PagedIterable<ShareFileItem> listFilesAndDirectories(ShareListFilesAndDirectoriesOptions options, Duration timeout, Context context)

Parameters

options
ShareListFilesAndDirectoriesOptions

Optional parameters.

timeout
java.time.Duration

An optional timeout applied to the operation. If a response is not returned before the timeout concludes a RuntimeException will be thrown.

context
Context

Additional context that is passed through the Http pipeline during the service call.

Returns

ShareFileItem in this directory with prefix and max number of return results.

listFilesAndDirectories(String prefix, Integer maxResultsPerPage, Duration timeout, Context context)

Lists all sub-directories and files in this directory with their prefix or snapshots.

Code Samples

List all sub-directories and files in this directory with "subdir" prefix and return 10 results in the account

shareDirectoryClient.listFilesAndDirectories("subdir", 10, Duration.ofSeconds(1),
     new Context(key1, value1)).forEach(
         fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.",
             fileRef.isDirectory(), fileRef.getName())
 );

For more information, see the Azure Docs.

public PagedIterable<ShareFileItem> listFilesAndDirectories(String prefix, Integer maxResultsPerPage, Duration timeout, Context context)

Parameters

prefix
java.lang.String

Optional prefix which filters the results to return only files and directories whose name begins with.

maxResultsPerPage
java.lang.Integer

Optional maximum number of files and/or directories to return per page. If the request does not specify maxResultsPerPage or specifies a value greater than 5,000, the server will return up to 5,000 items. If iterating by page, the page size passed to byPage methods such as PagedIterable#iterableByPage(int) will be preferred over this value.

timeout
java.time.Duration

An optional timeout applied to the operation. If a response is not returned before the timeout concludes a RuntimeException will be thrown.

context
Context

Additional context that is passed through the Http pipeline during the service call.

Returns

ShareFileItem in this directory with prefix and max number of return results.

Applies to