Azure-docs: can't download a file, thinks it's a directory

Created on 1 Nov 2019  Â·  14Comments  Â·  Source: MicrosoftDocs/azure-docs

I did a azcopy login --tenant-id=<mytenantid>
that was successful
So then I tried copying a file out of a storage account blob. I do .\azcopy copy "https:\mystoraccount.blob.core.windows.net/mycontainer/blahblah.bak" "c:\temp\blahblah.bak"
but when I run that, it get failed to perform copy due to error: cannot use directory as source without --recursive.
but my bak file isn't a directory. it's a 'block blob (looking at the file I'm trying to download in my storage account, I see it's of type Block blob'. I tried to download a small log file, and get the same error (it too is a block blob). I'm running azcopy windows 64bit version 10.3.1.

if I add the --recursive, I get cannot start job due to error: cannot list blobs.

I can easily download the log file using Get-AzStorageBlobContent, and I inconsistently timeout downloading the bak file (no matter how big I set ServerTimeoutPerRequest/ClientTieoutPerRequest) (mostly it times out, occasionally it actually finishes)


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 commosubsvc cxp product-question storagsvc triaged

Most helpful comment

Seeing the same exact issue as @Plasma

azcopy copy 'https://asdf.blob.core.windows.net/asdf/filename.xlsx' '/asdf/filename.xlsx'

All 14 comments

@marc-gmail-towersap Thank you for the valuable feedback,we are investigating the issue.

@marc-gmail-towersap I did a quick test with the syntax below and it worked:

azcopy copy https://somestor.blob.core.windows.net/containername/filename C:\Users\adam\Desktop\testfolder
Can you try the same without adding any quotes ?

Let me know if it works.
Thanks,
Adam

sadly, same issue. Tried single quote, doublequote, no quote, even rolling back to azcopy version 10.3.0. I get this
INFO: Scanning...
INFO: Using OAuth token for authentication.
INFO: azcopy.exe: A newer version 10.3.1 is available to download

failed to perform copy command due to error: cannot use directory as source without --recursive or a trailing wildcard (/*)

@marc-gmail-towersap is it possible to try it from a non temp folder ? the correct syntax for the latest version seems to be without quotes(After doing the testing), is it also possible to try it on another machine ?

@marc-gmail-towersap any chance you tried the above recommendation ?

Thanks,
Adam

We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.

I can replicate this issue with latest build of AzCopy:

azcopy.exe copy "https://foobar.blob.core.windows.net/containerName/file.zip" "E:\folder\file.zip"

failed to perform copy command due to error: cannot use directory as source without --recursive or a trailing wildcard (/*)

However, I can successfully download the .ZIP file thru Azure Storage Explorer without issues. The "copy AzCopy command to clipboard" reveals that it adds the following parameters:

--overwrite=prompt --recursive --from-to=BlobLocal --check-md5 "FailIfDifferent"

My guess is since the content type is application/zip, it's treating the download is a directory?

Also having this issue. azcopy version 10.3.3

I have the same issue with version 10.3.3. I cannot even download a simple text file with azcopy.

So I was facing the same problem but resolved it by just adding the --recursive keyword at the end.
The if you get an authorization error: **Description=This request is not authorized to perform this operation using this permission, this means your blob has been set to Access key authentication and you need to use a SAS key along with your request.

So a simple file download command will look something like this
.\azcopy copy 'https://anupamstorageacct.blob.core.windows.net/testcontainer/Jorrit KT.zip?sv=2019-02-02&ss=b&srt=sco&sp=rwdlac&se=2020-01-28T14:14:35Z&st=2020-01-28T06:14:35Z&spr=https&sig=????????????????????????????????????%3D' 'C:Users\Anupam.Chand\OneDrive - Shell\Documents\Work\TEST.zip' --recursive

This will download the file Jorrit KT.zip into your specified folder in C: and rename it to TEST.zip
Remember that once you provide the SAS key to someone the only way to revoke access is by rotating the key1/2 that was used to sign the SAS with.

Getting this issue today on azcopy 10.3.4:

azcopy cp https://ACCOUNT.blob.core.windows.net/CONTAINER/EXAMPLE-PATH/this-example-file-2020-02-10_0000-seq539687800-part0.log.gz this-example-file-2020-02-10_0000-seq539687800-part0.log.gz
INFO: Scanning...
INFO: Using OAuth token for authentication.

failed to perform copy command due to error: cannot use directory as source without --recursive or a trailing wildcard (/*)

Seeing the same exact issue as @Plasma

azcopy copy 'https://asdf.blob.core.windows.net/asdf/filename.xlsx' '/asdf/filename.xlsx'

Using --recursive (even though the source is clearly a single blob) does work, but it's quite annoying when I forget to do it...

Version 10.6.0

This is still a problem on azcopy v10.8.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spottedmahn picture spottedmahn  Â·  3Comments

bdcoder2 picture bdcoder2  Â·  3Comments

varma31 picture varma31  Â·  3Comments

jharbieh picture jharbieh  Â·  3Comments

paulmarshall picture paulmarshall  Â·  3Comments