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?
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.
DataLakeServiceClient dataLakeServiceClient = new DataLakeServiceClient("<CONNECTION STRING>");
DataLakeFileSystemClient dataLakeFileSystemClient = dataLakeServiceClient.GetFileSystemClient("<CONTAINER>");
DataLakeFileClient sourceDataLakeFileClient = dataLakeFileSystemClient.GetFileClient("provision/<FILENAME>");
return await sourceDataLakeFileClient.RenameAsync("provision/Error/<FILENAME>");
RESULTS:
Before execution
After execution
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.