试图将文件从Azure Data Lake文件夹转移到另一个
我有函数应用程序从数据湖读取文件,并对文件内容进行一些处理。如果失败,则将文件移至“错误”文件夹。我尝试过,但没有成功。解决方案我尝试了 so-solution
public static async Task<DataLakeFileClient> MoveDirectory(string file)
{
DataLakeServiceClient serviceClient = await GetDataLakeClient();
DataLakeFileSystemClient filesystemClient =
serviceClient.GetFileSystemClient(<CONTAINER>);
DataLakeFileClient fileClient =
filesystemClient.GetFileClient("Provision/" + file);
return await fileClient.RenameAsync("Provision/Error/" + file);
}
引起404 sourcePathnotfound。
有什么提示或建议如何将文件从一个目录转移到另一个目录?
I have function app read the file from data lake and do some processing of the file content. If it failed it move the file to the "Error" folder. I tried this but was unsuccessful. Solution I tried SO-solution
public static async Task<DataLakeFileClient> MoveDirectory(string file)
{
DataLakeServiceClient serviceClient = await GetDataLakeClient();
DataLakeFileSystemClient filesystemClient =
serviceClient.GetFileSystemClient(<CONTAINER>);
DataLakeFileClient fileClient =
filesystemClient.GetFileClient("Provision/" + file);
return await fileClient.RenameAsync("Provision/Error/" + file);
}
Cause a 404 SourcePathNotFound.
Any tips or advice how I can move files from one directory to another?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
进行了几次更改之后,我们能够完成这项工作。在使用GetFileClient作为所需文件时,您需要使用DataLakeFileSystemClient而不是DataLakeserviceClient。以下是对我有用的代码。
结果:
执行前
执行后
After making a few changes we could able to get this work. While using GetFileClient for the required file you need to use DataLakeFileSystemClient instead of DataLakeServiceClient. Below is the code that worked for me.
RESULTS:
Before execution
After execution