gpt4 book ai didi

c# - 如何使用 C# 复制 Azure Data Lake Store 中的文件

转载 作者:行者123 更新时间:2023-12-03 03:07:36 25 4
gpt4 key购买 nike

我正在尝试将文件从一个文件夹复制/移动到 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com