简体   繁体   English

Azure存储Blob内容类型转换器

[英]Azure Storage Blob Content type Converter

I need to convert approx 250k images from having a content type of application/octetstream to image/jpg 我需要将内容类型为application / octetstream的大约250k图像转换为image / jpg

is there a powershell script I can utilise to do this or some sort of command code? 我可以利用Powershell脚本来执行此操作或某种命令代码吗?

There is a script available in Windows Azure Script Center repository, where you can use to batch change the content type of your files. Windows Azure脚本中心存储库中提供了一个脚本 ,您可以在其中用于批量更改文件的内容类型。

They provide also a video on how to use it. 他们还提供了有关如何使用它的视频

I don't think Windows Azure PowerShell Cmdlets has a readymade Cmdlet to do that. 我认为Windows Azure PowerShell Cmdlet没有现成的Cmdlet可以做到这一点。 If you're open to use 3rd party product, you can try Cerebrata's Azure Management Cmdlets . 如果您愿意使用第三方产品,可以尝试使用Cerebrata's Azure Management Cmdlets It has a Set-BlobProperties cmdlet using which you can set the content type. 它具有Set-BlobProperties cmdlet,可使用该cmdlet设置内容类型。

You can also do it through code as well. 您也可以通过代码来实现。 Essentially what you would do is fetch blobs from the blob container using ListBlobs or ListBlobsSegmented method and then iterate over these blobs and update the blob's properties via SetProperties method of CloudBlockBlob. 本质上,您要做的就是使用ListBlobsListBlobsSegmented方法从Blob容器中获取Blob,然后遍历这些Blob并通过CloudBlockBlob的SetProperties方法更新Blob的属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM