Reputation: 11
I am trying to copy/move the files from one folder to another folder within azure data lake. Business requires to create dynamic folders and move/copy the files. How to do that using c#?
Upvotes: 1
Views: 1782
Reputation: 731
Use the below code to Move/Rename files from Azure Data Lake Store folder.
If you want to rename the file, keep the dest_path as same.
If you want to move the files across folders then provide the destination folder path starting with "/"
DataLakeStoreFileSystemManagementClient _adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient();
public static void Move(string src_path, string dest_path)
{
_adlsFileSystemClient.FileSystem.Rename(_adlsAccountName, src_path, dest_path);
}
Calling Method for Renaming the file:
Move(_sourcePath + filename, _destinationPath + Path.GetFileNameWithoutExtension(filename)+".tsv");
Calling Method for Moving the file:
Move(_sourcePath + filename, _destinationPath + filename);
Upvotes: 1