Use AzCopy to synchronize local files to Azure Blob storage
At present, more and more companies in China have chosen to use Azure. They store some data in Azure Blob storage for distributed access, and at the same time, eliminate the hidden danger of data loss caused by local hardware failure.
However, in the actual production environment, there are some requirements to synchronize local data to the cloud, or cloud data to local, and AzCopy v10 released by Microsoft perfectly addresses this requirement. Let's take a look at how to use AzCopy v10 to synchronize the file system to Azure Blob storage.
To synchronize Blob files locally, run the following command:
.\ azcopy sync "https://azfile.blob.core.chinacloudapi.cn/111?sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-06-04T08:46:15Z&st=2019-06-04T00:46:15Z&spr=https&sig=ODGkLHnnRgp6hEw7yYhOljvUrJkjfW0OGyeW37aioX0%3D"" D:\ a "--recursive=true
On the contrary:
.\ azcopy sync "D:\ a"https://azfile.blob.core.chinacloudapi.cn/111?sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-06-04T08:46:15Z&st=2019-06-04T00:46:15Z&spr=https&sig=ODGkLHnnRgp6hEw7yYhOljvUrJkjfW0OGyeW37aioX0%3D"-- recursive=true"
If you want to run this script on a regular basis, you can set up scheduled tasks on Windows:
1. Set the Powershell execution policy to RemoteSigned
Set-ExecutionPolicy RemoteSigned
2. Create a scheduled task in the scheduled task
3. The test is completed.