Copy file from one container to another container in Azure Data Lake 2 programatically

Viewed 462

I have a storage account from type ADLS Gen2, with 2 containers. I would like to copy a blob file from container A to container B, with java SDK. I'm using DataLakeFileSystemClient and I'm looking for something like the rename method of DataLakeFileClient which supports renaming to other container.

Heres the example of rename I did:

private DataLakeFileSystemClient fileSystemClient;

public boolean rename(String source, String target, String targetContainer) {
    DataLakeFileClient dataLakeFileClient = fileSystemClient.getFileClient(source).rename(targetContainer, target);
    return dataLakeFileClient.exists();
}

But I'm looking for only copying and not moving, Thanks.

0 Answers
Related