none
Renaming specific folders with specific end name

    Question

  • Hello guys!

    Is there a way for rename a bunch of folders in Azure blob or file storage using Powershell or else using some conditions? Manually is impossible.... today we have folders names ending with .doc, .xls, .ppt, .jpg ....

    "D:\folder01\folder02.doc"

    "D:\folder01\folder03.xlsx" 

    and we really need to put a : at the end of it

    "D:\folder01\folder02.doc:"... "D:\folder01\folder03.xlsx:" 

    Any chance? =/

    Tuesday, January 17, 2017 2:32 PM

Answers

  • Hi Douglas,

    Thank you for contacting Microsoft forums. We are pleased to answer your query.

    Are you refereeing about renaming blob containers or renaming virtual folders within a container?

    There is no REST operation for renaming a container, they would need to create a new container with the new name and copy the blobs to the new container.

    https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/operations-on-containers

    So you can create a blob like: http:/yourstorage.blob.core.windows.net/document/folder/1.txt but any operations are at the container level, so same answer there is no rename operation.

    there is only a single layer of containers only the blob name in the above case is 'folder/1.txt'

     

    I hope that the reply will assist you in getting your query addressed. In case you require further assistance, please do reply to the thread as we are always available to your queries.


    Regards,
    Sumanth BM
    ---------------------------------------------------------------------------------------------------------
    Kindly click "Mark as Answer" on the post that helps you, this can be beneficial to other community members reading the thread. And Vote as Helpful.

    Tuesday, January 17, 2017 7:54 PM
    Moderator
  • Hi Douglas,

    as Sumanth already explained, there's no rename functionality. To take a little step back, there's no "folders" in the Blob storage. You upload your Blobs to the container, but any "folder" kind of structure are virtual directories (they don't exist); the name of your blob would be something like "folder1/folder2/filename.doc". Folder1 and Folder2 don't exist as physical directories, these are virtual directories.

    Now to rename your Blobs, you'll need to copy and remove them using Start-AzureStorageBlobCopy and Remove-AzureStorageBlob.

    Now, I understand you're struggling with adding the ":" symbol? What destination names are we talking about?

    I would advice you not to use any URL-related characters, as these need to be escaped. You can refer to the MSDN documentation for naming rules.


    Floris van der Ploeg - www.florisvanderploeg.com

    If my post was helpfull, remember to click the "Propose as answer" button.

    Wednesday, January 18, 2017 8:46 AM

All replies

  • Hi Douglas,

    Thank you for contacting Microsoft forums. We are pleased to answer your query.

    Are you refereeing about renaming blob containers or renaming virtual folders within a container?

    There is no REST operation for renaming a container, they would need to create a new container with the new name and copy the blobs to the new container.

    https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/operations-on-containers

    So you can create a blob like: http:/yourstorage.blob.core.windows.net/document/folder/1.txt but any operations are at the container level, so same answer there is no rename operation.

    there is only a single layer of containers only the blob name in the above case is 'folder/1.txt'

     

    I hope that the reply will assist you in getting your query addressed. In case you require further assistance, please do reply to the thread as we are always available to your queries.


    Regards,
    Sumanth BM
    ---------------------------------------------------------------------------------------------------------
    Kindly click "Mark as Answer" on the post that helps you, this can be beneficial to other community members reading the thread. And Vote as Helpful.

    Tuesday, January 17, 2017 7:54 PM
    Moderator
  • Hi Sumanth!!

    Thanks for you support! In fact we are trying to rename the folders, not the container itself...I am kind of struggling to copy all to another container and add the : symbol to the end of each folder that contains .doc, .xlsx, .ppt....Can you give me any tips on it?

    Regards!

    Tuesday, January 17, 2017 8:44 PM
  • Hi Douglas,

    as Sumanth already explained, there's no rename functionality. To take a little step back, there's no "folders" in the Blob storage. You upload your Blobs to the container, but any "folder" kind of structure are virtual directories (they don't exist); the name of your blob would be something like "folder1/folder2/filename.doc". Folder1 and Folder2 don't exist as physical directories, these are virtual directories.

    Now to rename your Blobs, you'll need to copy and remove them using Start-AzureStorageBlobCopy and Remove-AzureStorageBlob.

    Now, I understand you're struggling with adding the ":" symbol? What destination names are we talking about?

    I would advice you not to use any URL-related characters, as these need to be escaped. You can refer to the MSDN documentation for naming rules.


    Floris van der Ploeg - www.florisvanderploeg.com

    If my post was helpfull, remember to click the "Propose as answer" button.

    Wednesday, January 18, 2017 8:46 AM