gpt4 book ai didi

.net - 使用文件(非 Blob)存储以编程方式 (.NET) 重命名 Azure 文件或目录

转载 作者:行者123 更新时间:2023-12-03 00:52:13 27 4
gpt4 key购买 nike

我读到,使用 Azure 文件 存储创建的文件和目录可以通过编程方式重命名,但找不到使用 .NET Microsoft.WindowsAzure.Storage 程序集执行此操作的方法(我正在使用v4.3。)。我知道 blob 无法重命名,但使用文件存储的文件据说可以。作为引用,我添加了下面的代码片段。非常感谢任何帮助。

CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse("mycredentials");

CloudFileClient fileClient = cloudStorageAccount.CreateCloudFileClient();

CloudFileShare fileShare = fileClient.GetShareReference("myfileshare");

fileShare.CreateIfNotExists();

CloudFileDirectory rootDir = fileShare.GetRootDirectoryReference();

CloudFileDirectory directory = rootDir.GetDirectoryReference("mydirectory");

// The Name property of directory is read-only, and can't find a Rename method

最佳答案

到目前为止,Azure 上不支持重命名操作,这背后可能有原因,但是,替代方法是使用新名称创建副本并删除旧名称。甚至amazon s3也不支持重命名。原因可能是在多个级别上完成的索引和缓存,这些级别不能轻易重命名,因此它们没有作为核心功能包含在内。

关于.net - 使用文件(非 Blob)存储以编程方式 (.NET) 重命名 Azure 文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28816118/

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