我正在尝试将文件从一个文件夹复制/移动到 azure 数据湖中的另一个文件夹。业务需要创建动态文件夹并移动/复制文件。如何使用 C# 做到这一点?
最佳答案
使用以下代码从 Azure Data Lake Store 文件夹移动/重命名文件。
如果要重命名文件,请保持 dest_path 不变。
如果您想跨文件夹移动文件,请提供以“/”开头的目标文件夹路径
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);
关于c# - 如何使用 C# 复制 Azure Data Lake Store 中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42973705/