Azure Data Lake Gen2 - How do I move files from folder to another folder using C#

Viewed 1518

I have provisioned Datalake gen2 and in C# I am looking for an option on how to move a file from one folder to another folder? With blob storage it's simple but with Datalake I am getting confused about which SDK to use and how it can be done in C#

Also, can I use SAS token generated at the container level for authentication?

1 Answers

If you want to move a file from one folder to another folder in Azure Data Lake Gen2, please refer to the following code

public async Task<DataLakeFileClient> MoveDirectory
    (DataLakeFileSystemClient fileSystemClient)
{
    DataLakeFileClient fileClient=
         fileSystemClient.GetFileClient("<file path>");

    return await fileClient.RenameAsync("<new file path>");
}

For more details, please refer to here and here

Besides, we can use the sas token to manage azure data lake gen2 resource. Regarding how to generate sas token, please refer to here.

Related