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#?
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.