Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename file/directory (not Blob file) in Azure Storage (not Blob storage)?

I thought that this would be very easy job to do, but as I have researched, I found nothing on how to rename a file or directory in Azure Storage.

I don't want to do a copy/delete (the size of files/directories is very large), I just want to change the name of a given file/directory programmatically through C#.

Edit: I'm talking about CloudFile/CloudFileDirectory objects.

Can someone help me?

like image 690
IMollov Avatar asked May 29 '18 08:05

IMollov


People also ask

How do I rename a file in Azure?

To rename a file or a folder, simply select the file or folder and either click the “Rename” button from the top button bar or invoke the context menu and choose “Rename…” option. You can then specify the new name for the file or folder in the popup window that opens up.

What is the difference between blob and file storage in Azure?

Azure File Storage and Blob Storage offer the same level of redundancy, but Azure Blob Storage is cheaper than File Storage. Azure File Storage provides the folder for the data storage, while Azure Blob Storage does not provide the folder. They give a flat structure for data storage.

What is the other name for blob storage in Azure?

Blob Storage supports Azure Data Lake Storage Gen2, Microsoft's enterprise big data analytics solution for the cloud. Azure Data Lake Storage Gen2 offers a hierarchical file system as well as the advantages of Blob Storage, including: Low-cost, tiered storage.

Can you rename an Azure storage container?

Answers. You would need to create a new storage account, copy content of the existing storage account, and delete it afterwards.


1 Answers

You talk about Azure Files. Similar to Azure Blob Storage, there is no rename / move feature thus you have to copy the file (e. g. using StartCopyAsync) and then delete it using the CloudFile.DeleteAsync method.

I wrote a blog article about how to Rename Azure Storage Blob using PowerShell (same probably applies to Azure Files)

like image 114
Martin Brandl Avatar answered Sep 30 '22 21:09

Martin Brandl