2
votes

I'm trying to copy files to and from an Azure Fileshare using AZCopy v10. I have had this successfully working using v8.1 but I keep getting errors using v10.

From the command line I'm using this to copy a file from the local drive to the fileshare;

c:\Temp\azcopy.exe copy "c:\temp\sample.txt" "https://myfiles.file.core.windows.net/dbfiles/sample.txt?SASKeyText"

This generates the error message;

failed to perform copy command due to error: cannot transfer individual files/folders to the root of a service. Add a container or directory to the destination URL

I have tried adding a directory to the fileshare and adding that to the command string but I get the same error.

If I reverse the copy from the fileshare to the local drive I get the error;

failed to perform copy command due to error: account copies are an inherently recursive operation, and thus --recursive is required

I have followed the guide at https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-files but haven't been able to see what's wrong.

Thanks in advance for any help.

2
I am able to run this command without any problem.Gaurav Mantri
I'm running this from a local drive on a Windows10 machine using a DOS command line. Are you doing anything different?jhTuppeny
Nope. Same thing. I am using version 10.4.3.Gaurav Mantri
This is the command I am using azcopy.exe copy "D:\temp\test.txt" "https://account.file.core.windows.net/dbfiles/sample.txt?st=2020-06-24T15%3A55%3A51Z&se=2020-06-25T15%3A55%3A51Z&sp=rcwdl&sv=2018-03-28&sr=s&sig=<sig>"Gaurav Mantri
As far as I can see, that's exactly the same format as I'm using. Thanks for trying it out.jhTuppeny

2 Answers

1
votes

The error here was with the SAS token and not the form of the command.

I suppose this should be marked up amongst examples of unhelpful error messages.

Thanks to everyone who took the time to have a look.

0
votes

I had this same issue when trying to do a copy from my local machine to Azure Blob storage.

This was the command I was running:

azcopy copy --from-to=LocalBlob "C:\AzureStorageTest\my-app\*" "https://myapptest.blob.core.windows.net/%24web" --recursive

But I got the error below:

failed to perform copy command due to error: cannot transfer individual files/folders to the root of a service. Add a container or directory to the destination URL

Here's how I solved it:

I was missing the ?[SAS] argument at the end of the Blob storage location. So instead of this:

azcopy copy --from-to=LocalBlob "C:\AzureStorageTest\my-app\*" "https://myapptest.blob.core.windows.net/%24web" --recursive

I had this:

azcopy copy --from-to=LocalBlob "C:\AzureStorageTest\my-app\*" "https://myapptest.blob.core.windows.net/%24web?[SAS]" --recursive

Note:

  1. The format is azcopy copy "/path/to/dir" "https://[account].blob.core.windows.net/[container]/[path/to/directory]?[SAS]" --recursive. You only need to modify the "/path/to/dir", [account] and [container]/[path/to/directory]. Every other thing remains the way they are.
  2. Specify the source-destination routing using the --from-to=LocalBlob (if you're copying from local to blob storage) argument to be explicit about the copy operation.
  3. My actual Blob storage location is https://myapptest.blob.core.windows.net/$24web but I used https://myapptest.blob.core.windows.net/%24web, since $ will throw some error when used, so %24 was used.

That's all.

I hope this helps