繁体   English   中英

C# 将文件从一个目录移动到另一个目录 Azure 文件共享

[英]C# Move files from one directory to another on Azure File share

我正在处理需要通过 C# 控制台应用程序在 Azure 文件共享上读取和处理 CSV 文件的要求。 处理完文件后,我需要将其移至 Archived 文件夹,如果出现错误,请将其移至 Error 文件夹,文件共享结构如下:

csvfileshare --> 存储帐户下 Azure 上文件共享的名称。 这包含 .CSV 文件(csvfileshare/demo.csv) csvfileshare/Archived --> csvfileshare 下的目录/文件夹的名称,如果成功 csvfileshare/Error --> 文件所在的 csvfileshare 下的目录/文件夹的名称如果文件有错误,应该移动

您能否指导我如何在 C# 控制台应用程序中实现这一点,我已经到了能够从 Azure 文件共享读取文件到控制台应用程序并处理它们的地步,但无法将其移动到一个这些目录后处理。

谢谢!

您可能已经使用此模块来读取文件(在这种情况下,您拥有所需的一切),但答案是使用 azure.storage.blob.fileshare package。 如果您使用 Visual Studio,go 来管理 NuGet 包并搜索 Azure 存储。

以下 Microsoft 文档描述了使用该模块很好地操作 Azure 存储文件的过程。

https://docs.microsoft.com/en-us/azure/storage/files/storage-dotnet-how-to-use-files?tabs=dotnet

By the way, in Azure world, downloading/processing/uploading is not a very scalable model (as the client finally becomes a bottleneck), you may want to explore the possibility of using something like Azure logic apps or function apps, especially if you想要处理大量的文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM