AzCopy upload to specific folder

György Nagyapáti 96 Reputation points
2020-11-25T10:48:33.413+00:00

Hi,

I have azcopy installed on a Windows Server SBS 2011 Standard and I'd like to upload several hundred GBs of pst files with azcopy to an azure blob container but can't seem to find a way to upload files to a specific folder within the container. I've been looking for a solution online but can't seem to find any. I have folders in the blob container already (from uploading a folder that had folders within itself, recursively) but I can't find the right syntax to upload files with azcopy to any specific folder inside the container. All I can do is uploading to the root of the blob container. Is there a way to fix this?

The syntax I'm using is (running azcopy.exe as admin) azcopy.exe /Source:<local source folder path> /Dest:<SAS url for blob conatiner> /V:<local path for creating log file>

Now I have tried using...

/Dest:"<SAS url>"/foldername

/Dest:"<SAS url>"\foldername

/Dest:"<SAS url>/foldername"

/Dest:"<SAS url>\foldername"

But none of these worked. I've tried it with names of folders already existing in the blob container and also with non-existent foldernames (to see if they get created) but no luck so far.

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,639 questions
0 comments No comments
{count} votes

Accepted answer
  1. György Nagyapáti 96 Reputation points
    2020-11-26T08:24:22.747+00:00

    Okay, I found where I was mistaken. I mixed SAS url and SAS token:

    43002-image.png

    So the url to access the specific folder is the first part, before the question mark. Then (including the question mark) comes the SAS token. So if I want to chose a destination folder in my container, I just have to type it in the url like /foldername, right before the question mark of the SAS token. But correct me if I'm wrong, please.


2 additional answers

Sort by: Most helpful
  1. deherman-MSFT 35,636 Reputation points Microsoft Employee
    2020-11-25T17:49:08.053+00:00

    @György Nagyapáti
    You can refer to the second example here you will add the SAS token after myBlobDirectory. If the directory is not already created it will be created with this command.

    azcopy copy 'C:\myDirectory\*' 'https://mystorageaccount.blob.core.windows.net/mycontainer/myBlobDirectory/SAS-token'  
    

    Try this out and let me know if you have any issues.

    -------------------------------

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

  2. György Nagyapáti 96 Reputation points
    2020-11-26T08:03:57.58+00:00

    Hi,

    Thank you for answering. Could you please tell my how I can find my container's url address? Never opened it from a browser, I've always used Azure Storage explorer. There's only one url when I open the container in storage explorer and that one won't open in a browser. It says:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <Error>
    <Code>ResourceNotFound</Code>
    ....

    The resource clearly exists, I'm looking at it right now in Azure storage explorer and I can make changes in it.

    0 comments No comments