I have two folders in my storage account Source and destination folders I want to add Demo folder in my Source folder and I want to copy my source folder files to Demo folder and delete all my source folder files after copying in to Archieve folder
- how to create a folder inside another folder
- how to copy files from one folder to another folder
how to add a folder I am passing in this way:
var directory2 = container.GetDirectoryReference("csvfile / Source Folder / Archieve Folder");
CloudBlockBlob blockBlob2 = directory2.GetBlockBlobReference("empchange1.csv");
- containername-csvfile
- Folder-Source
- SubFolder-Archieve
There is no such thing as a (physical) folder in Azure Blob Storage. There is only the concept of virtual folders. By using a
/
in the name you are creating a virtual folder. For example, a blob namedvirtualfolder/myblob.ext
is placed in a virtual folder namedvirtualfolder
.If you want to create a virtual subfolder just put the name in the blob and use the '/' as delimiter like this:
virtualfolder/subfolder/myblob.ext
The notion of virtual folders is mentioned also if you take a look at the docs for cloudblobdirectory
That said, moving a blob to a different folder would therefore the same as renaming a blob to, for example
otherfolder/myblob.ext
. Unfortunately there is no API that allows you to rename a blob. The solution is to download the blob contents and upload it with a different name.