With AzCopy v10 the team added a new function to sync folders with Azure Blob Storage. This is great if you have a local folder running on a server or even on a client device which you can to keep synchronized with Azure Blob storage. This will not only upload new or changed files, with the “–delete-destination” parameter you can let AzCopy remove locally deleted files on Azure blob storage and vice-versa.
First, make sure you install and set up AzCopy.
Sync Folder with Azure Blob Storage
You can use the following command to sync a local folder with Azure Blob Storage. This command will only sync changed and new files, it compares file names and last modified timestamps.
azcopy sync "C:\Temp\images" "https://tomsaccount.blob.core.windows.net/images" --recursive
As mentioned, if you set the “–delete-destination” parameter to “true”, AzCopy deletes files without a prompt. If you want to check first, which files will be removed, before AzCopy deletes a file, set the –delete-destination flag to “prompt”.
To make sure you are not accidentally are deleting data, make sure to enable the soft delete feature before you use the –delete-destination parameter.
I deleted the file “3.jpg” locally and I ran the azcopy sync again. You can see that file “3.jpg” was removed from the Azure Blob Storage.
Sync to a local folder
To sync Azure Blob Storage to a local folder, you can use the following command.
azcopy sync "https://tomsaccount.blob.core.windows.net/images" "C:\Temp\images" --recursive
As of today, the sync feature does only supports local folders with Azure Blobs. Syncing with AWS or from Storage account to Storage account is currently not supported.
I hope this gives you a quick overview of how you can sync folder with Azure Blob Storage, if you want to know more, check out the Microsoft Docs about how you can transfer data using AzCopy. If you have any questions, please let me know in the comments.
Tags: AzCopy, Azure, Azure Blob Storage, Azure Storage, Cloud Storage, Microsoft, Microsoft Azure, sync, Sync Folder Last modified: June 4, 2019
Hi.
What if i want to “flag” a blob so that it doesn´t show up on a viewer/website, but is still stored in the azure storage?
Hi!
You wrote that syncing with AWS is currently not supported my AzCopy. Do you have any ideia if it’s possible?! Have you heard if the amazon has some tool to do it?
What I want is: after an upload happen in S3, the picture is also sent automatically to Azure Blob Storage.
thanks!
Hi Breno, I don’t have any information right now on the Sync fro AWS S3 to Azure option :)
I would recommend opening an issue on GitHub: https://github.com/Azure/azure-storage-azcopy
Very cool. Thanks for sharing. Perhaps as a follw up blog you can talk a little about the role requirements. I was using an admin account but had to assign roles before azcopy would work.
Hi
Thanks for sharing
to sync with only last modified only to storage account
or
to sync last 24 hours modified files
Any solution to this aspect….?
files that are modified in real time are transmitted repeatedly.