简体   繁体   English

如何删除Cloudinary上的zip文件?

[英]How to delete a zip file on Cloudinary?

My code creates a zip file by calling, 我的代码通过调用来创建一个zip文件,

Cloudinary.Multi()

Now I've to delete images.zip on cloudinary. 现在,我必须删除cloudinary上的images.zip。

Cloudinary.DeleteResourcesByTag() //don't work because images.zip has no tag to it.
Cloudinary.DeleteAllResources()  // Deletes all images. Zip files persist
Cloudinary.DeleteResources() //May work, what parameters should I pass to it?

I'm using Cloudinary .Net with PowerShell. 我将Cloudinary .Net与PowerShell一起使用。 An answer in C# or any syntax will be ok 用C#或任何语法的答案都可以

How can I delete the zip? 如何删除压缩文件?

Based on reply from Cloudinary support, 根据Cloudinary支持的回复,

In order to delete a ZIP file generated by the multi API, you should set its public ID, eg, outbox,zip (mind the comma), and also set the type to multi at the deletion API call. 为了删除由multi API生成的ZIP文件,您应该设置其公共ID,例如outbox,zip(注意逗号),并在删除API调用时将类型设置为multi。


I was able to develop a working solution as, 我能够开发出可行的解决方案,因为

Cloudinary cloudinary = new Cloudinary(account);

List<string> IDlist = new List<string>();
list.Add("outbox,zip");

DelResParams delParams = new DelResParams();
delParams.PublicIds = IDlist;
delParams.Type = "multi";

cloudinary.DeleteResources(delParams);


And the PowerShell version is, 而PowerShell版本是

$list = New-Object -TypeName System.Collections.Generic.List[string]

$list.Add("outbox,zip")

$deleteParams = New-Object CloudinaryDotNet.Actions.DelResParams
$deleteParams.PublicIDs = $list
$deleteParams.Type = "multi"


$cloudinary.DeleteResources($deleteParams)

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

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