Reputation: 33
I need to rename all blobs in a directory in azure storage to lower case as it is case sensitive.
I can do it by writing a c# program but a powershell script would be more convenient.
Does anyone has a script? Thx in advance!
Upvotes: 2
Views: 2823
Reputation: 71091
First, you should be aware that blobs cannot be renamed; you'd need to copy each one to a new blob, and then delete the old one when the copy operation is complete.
That said: For your PowerShell script, you could call Get-AzureStorageBlob
to get the blobs in a container, and then loop through them with For-EachObject
, executing a copy operation on (I believe $_.Name
(I'll leave this to you to try). You can copy blobs via Start-CopyAzureStorageBlob
, combined with Get-AzureStorageBlobCopyState
to know when the copy is complete.
Upvotes: 1