1

I have an azure blob container name "x" and I want to check if a file name "a.jpg" exists in that blob or not and return true or false based on that. It seems easy but there isn't a clear answer when I google it.

0

2 Answers 2

1

It is clearly mentioned in the document, if you are using c# you can use ExistsAsync method

public async Task<bool> FileExists(string fileName)
{
    return  await directory.GetBlockBlobReference(fileName).ExistsAsync();
}
Sign up to request clarification or add additional context in comments.

3 Comments

If I may ask, how did you find this repo?
I don't remember now . Either i would have used as a reference or got the sample code at that moment. Is that your repo?
1

You can also use REST Api if you want.

https://learn.microsoft.com/en-us/rest/api/storageservices/get-blob-metadata

A lot more trouble... but works too.

Request The Get Blob Metadata request may be constructed as follows. HTTPS is recommended. Replace myaccount with the name of your storage account:

TABLE 1 GET or HEAD Method Request URI HTTP Version https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=metadata

https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=metadata&snapshot=

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.