4

How do I create a copy of an existing file in an Azure Blob Storage container using code? I'm using the WindowsAzure.Storage NuGet package to handle all operations related to my Azure Blob Storage.

To be 100% clear, I'm trying to create a complete and separate copy of a file that's already been uploaded to a container on Azure Blob Storage. I also want to give the file a new name in the process.

0

2 Answers 2

2

Purely in code, you'll want to use StartCopyAsync() a method on CloudBlockBlob, to start the copy process.

Sign up to request clarification or add additional context in comments.

Comments

1

One simple way is to use a logic app that triggers on a blob being created that will then copy the blob.

https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-azureblobstorage

If you want to get more sophisticated, you can do a function app.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-storage-blob-triggered-function

3 Comments

yeah easiest way indeed :-)
Correct me if I'm wrong but I think this is a really good way if I don't want my app involved in the copy process. If I use StartCopyAsync(), I think I'm essentially creating a file stream in to my app, then creating a copy streaming out the bits out of my app. Am I getting it right?
@Sam - no, there is no bits streaming to and from your app. The copy is done within Azure Storage itself, which is initiated via the call to StartCopyAsync().

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.