DataLakeDirectoryAsyncClient Class

public final class DataLakeDirectoryAsyncClient
extends DataLakePathAsyncClient

This class provides a client that contains directory operations for Azure Storage Data Lake. Operations provided by this client include creating a directory, deleting a directory, renaming a directory, setting metadata and http headers, setting and retrieving access control, getting properties and creating and deleting files and subdirectories.

This client is instantiated through DataLakePathClientBuilder or retrieved via getDirectoryAsyncClient(String directoryName).

Please refer to the Azure Docs for more information.

Method Summary

Modifier and Type Method and Description
Mono<DataLakeFileAsyncClient> createFile(String fileName)

Creates a new file within a directory.

Mono<DataLakeFileAsyncClient> createFile(String fileName, boolean overwrite)

Creates a new file within a directory.

Mono<DataLakeFileAsyncClient> createFileIfNotExists(String fileName)

Creates a new file within a directory if it does not exist.

Mono<Response<DataLakeFileAsyncClient>> createFileIfNotExistsWithResponse(String fileName, DataLakePathCreateOptions options)

Creates a new file within a directory if it does not exist.

Mono<Response<DataLakeFileAsyncClient>> createFileWithResponse(String fileName, DataLakePathCreateOptions options)

Creates a new file within a directory.

Mono<Response<DataLakeFileAsyncClient>> createFileWithResponse(String fileName, String permissions, String umask, PathHttpHeaders headers, Map<String,String> metadata, DataLakeRequestConditions requestConditions)

Creates a new file within a directory.

Mono<DataLakeDirectoryAsyncClient> createSubdirectory(String subdirectoryName)

Creates a new sub-directory within a directory.

Mono<DataLakeDirectoryAsyncClient> createSubdirectory(String subdirectoryName, boolean overwrite)

Creates a new sub-directory within a directory.

Mono<DataLakeDirectoryAsyncClient> createSubdirectoryIfNotExists(String subdirectoryName)

Creates a new subdirectory within a directory if it does not exist.

Mono<Response<DataLakeDirectoryAsyncClient>> createSubdirectoryIfNotExistsWithResponse(String subdirectoryName, DataLakePathCreateOptions options)

Creates a new sub-directory within a directory if it does not exist.

Mono<Response<DataLakeDirectoryAsyncClient>> createSubdirectoryWithResponse(String subdirectoryName, DataLakePathCreateOptions options)

Creates a new sub-directory within a directory.

Mono<Response<DataLakeDirectoryAsyncClient>> createSubdirectoryWithResponse(String subdirectoryName, String permissions, String umask, PathHttpHeaders headers, Map<String,String> metadata, DataLakeRequestConditions requestConditions)

Creates a new sub-directory within a directory.

Mono<Void> delete()

Deletes a directory.

Mono<Void> deleteFile(String fileName)

Deletes the specified file in the file system.

Mono<Boolean> deleteFileIfExists(String fileName)

Deletes the specified file in the file system if it exists.

Mono<Response<Boolean>> deleteFileIfExistsWithResponse(String fileName, DataLakePathDeleteOptions options)

Deletes the specified file in the directory if it exists.

Mono<Response<Void>> deleteFileWithResponse(String fileName, DataLakeRequestConditions requestConditions)

Deletes the specified file in the directory.

Mono<Boolean> deleteIfExists()

Deletes a directory if it exists.

Mono<Response<Boolean>> deleteIfExistsWithResponse(DataLakePathDeleteOptions options)

Deletes a directory if it exists.

Mono<Void> deleteRecursively()

Recursively deletes a directory and all contents within the directory.

Mono<Response<Void>> deleteRecursivelyWithResponse(DataLakeRequestConditions requestConditions)

Recursively deletes a directory and all contents within the directory.

Mono<Void> deleteSubdirectory(String subdirectoryName)

Deletes the specified sub-directory in the directory.

Mono<Boolean> deleteSubdirectoryIfExists(String subdirectoryName)

Deletes the specified subdirectory in the directory if it exists.

Mono<Response<Boolean>> deleteSubdirectoryIfExistsWithResponse(String directoryName, DataLakePathDeleteOptions options)

Deletes the specified subdirectory in the directory if it exists.

Mono<Response<Void>> deleteSubdirectoryWithResponse(String directoryName, boolean recursive, DataLakeRequestConditions requestConditions)

Deletes the specified sub-directory in the directory.

Mono<Response<Void>> deleteWithResponse(boolean recursive, DataLakeRequestConditions requestConditions)

Deletes a directory.

DataLakeDirectoryAsyncClient getCustomerProvidedKeyAsyncClient(CustomerProvidedKey customerProvidedKey)

Creates a new DataLakeDirectoryAsyncClient with the specified customerProvidedKey.

String getDirectoryName()

Gets the name of this directory, not including its full path.

String getDirectoryPath()

Gets the path of this directory, not including the name of the resource itself.

String getDirectoryUrl()

Gets the URL of the directory represented by this client on the Data Lake service.

DataLakeFileAsyncClient getFileAsyncClient(String fileName)

Creates a new DataLakeFileAsyncClient object by concatenating fileName to the end of DataLakeDirectoryAsyncClient's URL.

DataLakeDirectoryAsyncClient getSubdirectoryAsyncClient(String subdirectoryName)

Creates a new DataLakeDirectoryAsyncClient object by concatenating subdirectoryName to the end of DataLakeDirectoryAsyncClient's URL.

PagedFlux<PathItem> listPaths()

Returns a reactive Publisher emitting all the files/directories in this directory lazily as needed.

PagedFlux<PathItem> listPaths(boolean recursive, boolean userPrincipleNameReturned, Integer maxResults)

Returns a reactive Publisher emitting all the files/directories in this directory lazily as needed.

Mono<DataLakeDirectoryAsyncClient> rename(String destinationFileSystem, String destinationPath)

Moves the directory to another location within the file system.

Mono<Response<DataLakeDirectoryAsyncClient>> renameWithResponse(String destinationFileSystem, String destinationPath, DataLakeRequestConditions sourceRequestConditions, DataLakeRequestConditions destinationRequestConditions)

Moves the directory to another location within the file system.

Methods inherited from DataLakePathAsyncClient

Methods inherited from java.lang.Object

Method Details

createFile

public Mono createFile(String fileName)

Creates a new file within a directory. By default, this method will not overwrite an existing file. For more information, see the Azure Docs.

Code Samples

DataLakeFileAsyncClient fileClient = client.createFile(fileName).block();

Parameters:

fileName - Name of the file to create.

Returns:

A Mono containing a DataLakeFileAsyncClient used to interact with the file created.

createFile

public Mono createFile(String fileName, boolean overwrite)

Creates a new file within a directory. For more information, see the Azure Docs.

Code Samples

boolean overwrite = false; /* Default value. */
 DataLakeFileAsyncClient fClient = client.createFile(fileName, overwrite).block();

Parameters:

fileName - Name of the file to create.
overwrite - Whether to overwrite, should the file exist.

Returns:

A Mono containing a DataLakeFileAsyncClient used to interact with the file created.

createFileIfNotExists

public Mono createFileIfNotExists(String fileName)

Creates a new file within a directory if it does not exist. By default this method will not overwrite an existing file. For more information, see the Azure Docs.

Code Samples

DataLakeFileAsyncClient fileClient = client.createFileIfNotExists(fileName).block();

Parameters:

fileName - Name of the file to create.

Returns:

A Mono containing a DataLakeFileAsyncClient used to interact with the file created.

createFileIfNotExistsWithResponse

public Mono> createFileIfNotExistsWithResponse(String fileName, DataLakePathCreateOptions options)

Creates a new file within a directory if it does not exist. For more information, see the Azure Docs.

Code Samples

PathHttpHeaders headers = new PathHttpHeaders()
     .setContentLanguage("en-US")
     .setContentType("binary");
 String permissions = "permissions";
 String umask = "umask";
 DataLakePathCreateOptions options = new DataLakePathCreateOptions()
     .setPermissions(permissions)
     .setUmask(umask)
     .setPathHttpHeaders(headers)
     .setMetadata(Collections.singletonMap("metadata", "value"));

 client.createFileIfNotExistsWithResponse(fileName, options).subscribe(response -> {
     if (response.getStatusCode() == 409) {
         System.out.println("Already exists.");
     } else {
         System.out.println("successfully created.");
     }
 });

Parameters:

fileName - Name of the file to create.
options - DataLakePathCreateOptions metadata key or value, it must be removed or encoded.

Returns:

A Mono containing a Response<T> whose value contains a DataLakeFileAsyncClient used to interact with the file created. If Response<T>'s status code is 201, a new file was successfully created. If status code is 409, a file with the same name already existed at this location.

createFileWithResponse

public Mono> createFileWithResponse(String fileName, DataLakePathCreateOptions options)

Creates a new file within a directory. If a file with the same name already exists, the file will be overwritten. For more information, see the Azure Docs.

Code Samples

PathHttpHeaders httpHeaders = new PathHttpHeaders()
     .setContentLanguage("en-US")
     .setContentType("binary");
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 Map<String, String> metadata = Collections.singletonMap("metadata", "value");
 String permissions = "permissions";
 String umask = "umask";
 String owner = "rwx";
 String group = "r--";
 String leaseId = CoreUtils.randomUuid().toString();
 Integer duration = 15;
 DataLakePathCreateOptions options = new DataLakePathCreateOptions()
     .setPermissions(permissions)
     .setUmask(umask)
     .setOwner(owner)
     .setGroup(group)
     .setPathHttpHeaders(httpHeaders)
     .setRequestConditions(requestConditions)
     .setMetadata(metadata)
     .setProposedLeaseId(leaseId)
     .setLeaseDuration(duration);

 DataLakeFileAsyncClient newFileClient = client.createFileWithResponse(fileName, options).block().getValue();

Parameters:

fileName - Name of the file to create.

Returns:

A Mono containing a Response<T> whose value contains a DataLakeFileAsyncClient used to interact with the file created.

createFileWithResponse

public Mono> createFileWithResponse(String fileName, String permissions, String umask, PathHttpHeaders headers, Map metadata, DataLakeRequestConditions requestConditions)

Creates a new file within a directory. If a file with the same name already exists, the file will be overwritten. For more information, see the Azure Docs.

Code Samples

PathHttpHeaders httpHeaders = new PathHttpHeaders()
     .setContentLanguage("en-US")
     .setContentType("binary");
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 String permissions = "permissions";
 String umask = "umask";
 DataLakeFileAsyncClient newFileClient = client.createFileWithResponse(fileName,
     permissions, umask, httpHeaders, Collections.singletonMap("metadata", "value"), requestConditions
 ).block().getValue();

Parameters:

fileName - Name of the file to create.
permissions - POSIX access permissions for the file owner, the file owning group, and others.
umask - Restricts permissions of the file to be created.
headers - PathHttpHeaders
metadata - Metadata to associate with the file. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.
requestConditions - DataLakeRequestConditions

Returns:

A Mono containing a Response<T> whose value contains a DataLakeFileAsyncClient used to interact with the file created.

createSubdirectory

public Mono createSubdirectory(String subdirectoryName)

Creates a new sub-directory within a directory. By default, this method will not overwrite an existing sub-directory. For more information, see the Azure Docs.

Code Samples

DataLakeDirectoryAsyncClient directoryClient = client.createSubdirectory(directoryName).block();

Parameters:

subdirectoryName - Name of the sub-directory to create.

Returns:

A Mono containing a DataLakeDirectoryAsyncClient used to interact with the directory created.

createSubdirectory

public Mono createSubdirectory(String subdirectoryName, boolean overwrite)

Creates a new sub-directory within a directory. For more information, see the Azure Docs.

Code Samples

boolean overwrite = false; /* Default value. */
 DataLakeDirectoryAsyncClient dClient = client.createSubdirectory(directoryName, overwrite).block();

Parameters:

subdirectoryName - Name of the sub-directory to create.
overwrite - Whether to overwrite, should the subdirectory exist.

Returns:

A Mono containing a DataLakeDirectoryAsyncClient used to interact with the directory created.

createSubdirectoryIfNotExists

public Mono createSubdirectoryIfNotExists(String subdirectoryName)

Creates a new subdirectory within a directory if it does not exist. For more information, see the Azure Docs.

Code Samples

DataLakeDirectoryAsyncClient subdirectoryClient = client.createSubdirectoryIfNotExists(directoryName).block();

Parameters:

subdirectoryName - Name of the sub-directory to create.

Returns:

A Mono containing a DataLakeDirectoryAsyncClient used to interact with the subdirectory created.

createSubdirectoryIfNotExistsWithResponse

public Mono> createSubdirectoryIfNotExistsWithResponse(String subdirectoryName, DataLakePathCreateOptions options)

Creates a new sub-directory within a directory if it does not exist. For more information, see the Azure Docs.

Code Samples

PathHttpHeaders headers = new PathHttpHeaders()
     .setContentLanguage("en-US")
     .setContentType("binary");
 String permissions = "permissions";
 String umask = "umask";
 DataLakePathCreateOptions options = new DataLakePathCreateOptions()
     .setPermissions(permissions)
     .setUmask(umask)
     .setPathHttpHeaders(headers)
     .setMetadata(Collections.singletonMap("metadata", "value"));

 client.createSubdirectoryIfNotExistsWithResponse(directoryName, options).subscribe(response -> {
     if (response.getStatusCode() == 409) {
         System.out.println("Already exists.");
     } else {
         System.out.println("successfully created.");
     }
 });

Parameters:

subdirectoryName - Name of the subdirectory to create.

Returns:

A Mono containing a Response<T> whose value contains a DataLakeDirectoryAsyncClient used to interact with the subdirectory created. If Response<T>'s status code is 201, a new subdirectory was successfully created. If status code is 409, a subdirectory with the same name already existed at this location.

createSubdirectoryWithResponse

public Mono> createSubdirectoryWithResponse(String subdirectoryName, DataLakePathCreateOptions options)

Creates a new sub-directory within a directory. If a sub-directory with the same name already exists, the sub-directory will be overwritten. For more information, see the Azure Docs.

Code Samples

PathHttpHeaders httpHeaders = new PathHttpHeaders()
     .setContentLanguage("en-US")
     .setContentType("binary");
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 Map<String, String> metadata = Collections.singletonMap("metadata", "value");
 String permissions = "permissions";
 String umask = "umask";
 String owner = "rwx";
 String group = "r--";
 String leaseId = CoreUtils.randomUuid().toString();
 Integer duration = 15;
 DataLakePathCreateOptions options = new DataLakePathCreateOptions()
     .setPermissions(permissions)
     .setUmask(umask)
     .setOwner(owner)
     .setGroup(group)
     .setPathHttpHeaders(httpHeaders)
     .setRequestConditions(requestConditions)
     .setMetadata(metadata)
     .setProposedLeaseId(leaseId)
     .setLeaseDuration(duration);

 DataLakeDirectoryAsyncClient newDirectoryClient = client.createSubdirectoryWithResponse(directoryName, options)
     .block().getValue();

Parameters:

subdirectoryName - Name of the sub-directory to create.

Returns:

A Mono containing a Response<T> whose value contains a DataLakeDirectoryAsyncClient used to interact with the sub-directory created.

createSubdirectoryWithResponse

public Mono> createSubdirectoryWithResponse(String subdirectoryName, String permissions, String umask, PathHttpHeaders headers, Map metadata, DataLakeRequestConditions requestConditions)

Creates a new sub-directory within a directory. If a sub-directory with the same name already exists, the sub-directory will be overwritten. For more information, see the Azure Docs.

Code Samples

PathHttpHeaders httpHeaders = new PathHttpHeaders()
     .setContentLanguage("en-US")
     .setContentType("binary");
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 String permissions = "permissions";
 String umask = "umask";
 DataLakeDirectoryAsyncClient newDirectoryClient = client.createSubdirectoryWithResponse(
     directoryName, permissions, umask, httpHeaders, Collections.singletonMap("metadata", "value"),
     requestConditions
 ).block().getValue();

Parameters:

subdirectoryName - Name of the sub-directory to create.
permissions - POSIX access permissions for the sub-directory owner, the sub-directory owning group, and others.
umask - Restricts permissions of the sub-directory to be created.
headers - PathHttpHeaders
metadata - Metadata to associate with the resource. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.
requestConditions - DataLakeRequestConditions

Returns:

A Mono containing a Response<T> whose value contains a DataLakeDirectoryAsyncClient used to interact with the sub-directory created.

delete

public Mono delete()

Deletes a directory.

Code Samples

client.delete().subscribe(response ->
     System.out.println("Delete request completed"));

For more information see the Azure Docs

Returns:

A reactive response signalling completion.

deleteFile

public Mono deleteFile(String fileName)

Deletes the specified file in the file system. If the file doesn't exist the operation fails. For more information see the Azure Docs.

Code Samples

client.deleteFile(fileName).subscribe(response ->
     System.out.println("Delete request completed"));

Parameters:

fileName - Name of the file to delete.

Returns:

A reactive response signalling completion.

deleteFileIfExists

public Mono deleteFileIfExists(String fileName)

Deletes the specified file in the file system if it exists. For more information see the Azure Docs.

Code Samples

client.deleteFileIfExists(fileName).subscribe(deleted -> {
     if (deleted) {
         System.out.println("successfully deleted.");
     } else {
         System.out.println("Does not exist.");
     }
 });

Parameters:

fileName - Name of the file to delete.

Returns:

a reactive response signaling completion. true indicates that the specified file was successfully deleted, false indicates that the specified file did not exist.

deleteFileIfExistsWithResponse

public Mono> deleteFileIfExistsWithResponse(String fileName, DataLakePathDeleteOptions options)

Deletes the specified file in the directory if it exists. For more information see the Azure Docs.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(false)
     .setRequestConditions(requestConditions);

 client.deleteFileIfExistsWithResponse(fileName, options).subscribe(response -> {
     if (response.getStatusCode() == 404) {
         System.out.println("Does not exist.");
     } else {
         System.out.println("successfully deleted.");
     }
 });

Parameters:

fileName - Name of the file to delete.

Returns:

A reactive response signaling completion. If Response<T>'s status code is 200, the specified file was successfully deleted. If status code is 404, the specified file does not exist.

deleteFileWithResponse

public Mono> deleteFileWithResponse(String fileName, DataLakeRequestConditions requestConditions)

Deletes the specified file in the directory. If the file doesn't exist the operation fails. For more information see the Azure Docs.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);

 client.deleteFileWithResponse(fileName, requestConditions)
     .subscribe(response -> System.out.println("Delete request completed"));

Parameters:

fileName - Name of the file to delete.
requestConditions - DataLakeRequestConditions

Returns:

A Mono containing status code and HTTP headers

deleteIfExists

public Mono deleteIfExists()

Deletes a directory if it exists.

Code Samples

client.deleteIfExists().subscribe(deleted -> {
     if (deleted) {
         System.out.println("Successfully deleted.");
     } else {
         System.out.println("Does not exist.");
     }
 });

For more information see the Azure Docs

Overrides:

DataLakeDirectoryAsyncClient.deleteIfExists()

Returns:

a reactive response signaling completion. true indicates that the directory was successfully deleted, true indicates that the directory did not exist.

deleteIfExistsWithResponse

public Mono> deleteIfExistsWithResponse(DataLakePathDeleteOptions options)

Deletes a directory if it exists.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 boolean recursive = false; // Default value
 DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(recursive)
     .setRequestConditions(requestConditions);

 client.deleteIfExistsWithResponse(options).subscribe(response -> {
     if (response.getStatusCode() == 404) {
         System.out.println("Does not exist.");
     } else {
         System.out.println("successfully deleted.");
     }
 });

For more information see the Azure Docs

Overrides:

DataLakeDirectoryAsyncClient.deleteIfExistsWithResponse(DataLakePathDeleteOptions options)

Parameters:

Returns:

A reactive response signaling completion. If Response<T>'s status code is 200, the directory was successfully deleted. If status code is 404, the directory does not exist.

deleteRecursively

public Mono deleteRecursively()

Recursively deletes a directory and all contents within the directory.

Code Samples

client.deleteRecursively().subscribe(response ->
     System.out.println("Delete request completed"));

For more information see the Azure Docs

Returns:

A reactive response signalling completion.

deleteRecursivelyWithResponse

public Mono> deleteRecursivelyWithResponse(DataLakeRequestConditions requestConditions)

Recursively deletes a directory and all contents within the directory.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 boolean recursive = false; // Default value

 client.deleteWithResponse(recursive, requestConditions)
     .subscribe(response -> System.out.println("Delete request completed"));

For more information see the Azure Docs

Parameters:

requestConditions - DataLakeRequestConditions

Returns:

A reactive response signalling completion.

deleteSubdirectory

public Mono deleteSubdirectory(String subdirectoryName)

Deletes the specified sub-directory in the directory. If the sub-directory doesn't exist or is not empty the operation fails. For more information see the Azure Docs.

Code Samples

client.deleteSubdirectory(directoryName).subscribe(response ->
     System.out.println("Delete request completed"));

Parameters:

subdirectoryName - Name of the sub-directory to delete.

Returns:

A reactive response signalling completion.

deleteSubdirectoryIfExists

public Mono deleteSubdirectoryIfExists(String subdirectoryName)

Deletes the specified subdirectory in the directory if it exists. For more information see the Azure Docs.

Code Samples

client.deleteSubdirectoryIfExists(directoryName).subscribe(deleted -> {
     if (deleted) {
         System.out.println("Successfully deleted.");
     } else {
         System.out.println("Does not exist.");
     }
 });

Parameters:

subdirectoryName - Name of the subdirectory to delete.

Returns:

A reactive response signaling completion. true indicates that the subdirectory was deleted. false indicates the specified subdirectory does not exist.

deleteSubdirectoryIfExistsWithResponse

public Mono> deleteSubdirectoryIfExistsWithResponse(String directoryName, DataLakePathDeleteOptions options)

Deletes the specified subdirectory in the directory if it exists. For more information see the Azure Docs.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 boolean recursive = false; // Default value
 DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(recursive)
     .setRequestConditions(requestConditions);

 client.deleteSubdirectoryIfExistsWithResponse(directoryName, options).subscribe(response -> {
     if (response.getStatusCode() == 404) {
         System.out.println("Does not exist.");
     } else {
         System.out.println("successfully deleted.");
     }
 });

Parameters:

directoryName - Name of the subdirectory to delete.

Returns:

A reactive response signaling completion. If Response<T>'s status code is 200, the specified subdirectory was successfully deleted. If status code is 404, the specified subdirectory does not exist.

deleteSubdirectoryWithResponse

public Mono> deleteSubdirectoryWithResponse(String directoryName, boolean recursive, DataLakeRequestConditions requestConditions)

Deletes the specified sub-directory in the directory. If the sub-directory doesn't exist or is not empty the operation fails. For more information see the Azure Docs.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 boolean recursive = false; // Default value

 client.deleteSubdirectoryWithResponse(directoryName, recursive, requestConditions)
     .subscribe(response -> System.out.println("Delete request completed"));

Parameters:

directoryName - Name of the sub-directory to delete.
recursive - Whether to delete all paths beneath the sub-directory.
requestConditions - DataLakeRequestConditions

Returns:

A Mono containing status code and HTTP headers

deleteWithResponse

public Mono> deleteWithResponse(boolean recursive, DataLakeRequestConditions requestConditions)

Deletes a directory.

Code Samples

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 boolean recursive = false; // Default value

 client.deleteWithResponse(recursive, requestConditions)
     .subscribe(response -> System.out.println("Delete request completed"));

For more information see the Azure Docs

Parameters:

recursive - Whether to delete all paths beneath the directory.
requestConditions - DataLakeRequestConditions

Returns:

A reactive response signalling completion.

getCustomerProvidedKeyAsyncClient

public DataLakeDirectoryAsyncClient getCustomerProvidedKeyAsyncClient(CustomerProvidedKey customerProvidedKey)

Creates a new DataLakeDirectoryAsyncClient with the specified customerProvidedKey.

Overrides:

DataLakeDirectoryAsyncClient.getCustomerProvidedKeyAsyncClient(CustomerProvidedKey customerProvidedKey)

Parameters:

customerProvidedKey - the CustomerProvidedKey for the directory, pass null to use no customer provided key.

Returns:

a DataLakeDirectoryAsyncClient with the specified customerProvidedKey.

getDirectoryName

public String getDirectoryName()

Gets the name of this directory, not including its full path.

Returns:

The name of the directory.

getDirectoryPath

public String getDirectoryPath()

Gets the path of this directory, not including the name of the resource itself.

Returns:

The path of the directory.

getDirectoryUrl

public String getDirectoryUrl()

Gets the URL of the directory represented by this client on the Data Lake service.

Returns:

the URL.

getFileAsyncClient

public DataLakeFileAsyncClient getFileAsyncClient(String fileName)

Creates a new DataLakeFileAsyncClient object by concatenating fileName to the end of DataLakeDirectoryAsyncClient's URL. The new DataLakeFileAsyncClient uses the same request policy pipeline as the DataLakeDirectoryAsyncClient.

Code Samples

DataLakeFileAsyncClient dataLakeFileClient = client.getFileAsyncClient(fileName);

Parameters:

fileName - A String representing the name of the file.

Returns:

A new DataLakeFileAsyncClient object which references the file with the specified name in this file system.

getSubdirectoryAsyncClient

public DataLakeDirectoryAsyncClient getSubdirectoryAsyncClient(String subdirectoryName)

Creates a new DataLakeDirectoryAsyncClient object by concatenating subdirectoryName to the end of DataLakeDirectoryAsyncClient's URL. The new DataLakeDirectoryAsyncClient uses the same request policy pipeline as the DataLakeDirectoryAsyncClient.

Code Samples

DataLakeDirectoryAsyncClient dataLakeDirectoryClient = client.getSubdirectoryAsyncClient(directoryName);

Parameters:

subdirectoryName - A String representing the name of the sub-directory.

Returns:

A new DataLakeDirectoryAsyncClient object which references the directory with the specified name in this file system.

listPaths

public PagedFlux listPaths()

Returns a reactive Publisher emitting all the files/directories in this directory lazily as needed. For more information, see the Azure Docs.

Code Samples

client.listPaths().subscribe(path -> System.out.printf("Name: %s%n", path.getName()));

Returns:

A reactive response emitting the list of files/directories.

listPaths

public PagedFlux listPaths(boolean recursive, boolean userPrincipleNameReturned, Integer maxResults)

Returns a reactive Publisher emitting all the files/directories in this directory lazily as needed. For more information, see the Azure Docs.

Code Samples

client.listPaths(false, false, 10)
     .subscribe(path -> System.out.printf("Name: %s%n", path.getName()));

Parameters:

recursive - Specifies if the call should recursively include all paths.
userPrincipleNameReturned - If "true", the user identity values returned by the x-ms-owner, x-ms-group, and x-ms-acl response headers will be transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be returned as Azure Active Directory Object IDs. The default value is false. Note that group and application Object IDs are not translated because they do not have unique friendly names.
maxResults - Specifies the maximum number of blobs to return per page, including all BlobPrefix elements. If the request does not specify maxResults or specifies a value greater than 5,000, the server will return up to 5,000 items per page.

Returns:

A reactive response emitting the list of files/directories.

rename

public Mono rename(String destinationFileSystem, String destinationPath)

Moves the directory to another location within the file system. For more information see the Azure Docs.

Code Samples

DataLakeDirectoryAsyncClient renamedClient = client.rename(fileSystemName, destinationPath).block();
 System.out.println("Directory Client has been renamed");

Parameters:

destinationFileSystem - The file system of the destination within the account. null for the current file system.
destinationPath - Relative path from the file system to rename the directory to, excludes the file system name. For example if you want to move a directory with fileSystem = "myfilesystem", path = "mydir/mysubdir" to another path in myfilesystem (ex: newdir) then set the destinationPath = "newdir"

Returns:

A Mono containing a DataLakeDirectoryAsyncClient used to interact with the new directory created.

renameWithResponse

public Mono> renameWithResponse(String destinationFileSystem, String destinationPath, DataLakeRequestConditions sourceRequestConditions, DataLakeRequestConditions destinationRequestConditions)

Moves the directory to another location within the file system. For more information, see the Azure Docs.

Code Samples

DataLakeRequestConditions sourceRequestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 DataLakeRequestConditions destinationRequestConditions = new DataLakeRequestConditions();

 DataLakeDirectoryAsyncClient newRenamedClient = client.renameWithResponse(fileSystemName, destinationPath,
     sourceRequestConditions, destinationRequestConditions).block().getValue();
 System.out.println("Directory Client has been renamed");

Parameters:

destinationFileSystem - The file system of the destination within the account. null for the current file system.
destinationPath - Relative path from the file system to rename the directory to, excludes the file system name. For example if you want to move a directory with fileSystem = "myfilesystem", path = "mydir/mysubdir" to another path in myfilesystem (ex: newdir) then set the destinationPath = "newdir"
sourceRequestConditions - DataLakeRequestConditions against the source.
destinationRequestConditions - DataLakeRequestConditions against the destination.

Returns:

A Mono containing a Response<T> whose value contains a DataLakeDirectoryAsyncClient used to interact with the directory created.

Applies to