简体   繁体   中英

How to delete a zip file on Cloudinary?

My code creates a zip file by calling,

Cloudinary.Multi()

Now I've to delete images.zip on cloudinary.

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. An answer in C# or any syntax will be ok

How can I delete the zip?

Based on reply from Cloudinary support,

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.


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,

$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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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