如何使用Azure Storage SDK将Azure File Storage上的文件从一个子文件夹移动到另一个子文件夹? [英] How to move a file on Azure File Storage from one sub folder to another sub folder using the Azure Storage SDK?
本文介绍了如何使用Azure Storage SDK将Azure File Storage上的文件从一个子文件夹移动到另一个子文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图弄清楚如何将Azure File Storage中的文件从一个位置移动到同一共享中的另一个位置.
I'm trying to figure out how to move a file in Azure File Storage from one location to another location, in the same share.
例如
source -> \\Share1\someFile.txt
destination -> \\Share1\Foo\Bar\someFile.txt
- 我需要先复制文件,然后再删除源文件吗?
- 如果目的地子目录不存在怎么办?首先需要为每个子目录
CreateIfNotExistsAsync
吗? - Do I need to copy the file first, then delete the source?
- What if the destination sub-directory aren't there? do I need to
CreateIfNotExistsAsync
for each sub-directory, first?
欢呼!
推荐答案
这是您需要的是StartCopy
方法,将文件从一个位置复制到另一位置.
What you need is the StartCopy
method to copy the file from one location to another.
// Start the copy operation.
destinationFile.StartCopy(sourceFile);
是的,如果目标目录不存在,则必须创建它.
And, yes, you will have to create the destination directory if it does not exist.
这篇关于如何使用Azure Storage SDK将Azure File Storage上的文件从一个子文件夹移动到另一个子文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文