This code will help you to delete list of files in a folder using CloudBlobContainer reference
public void deleteFilesFromAzure(CloudBlobContainer _blobContainer)
{
CloudBlobDirectory blobDirectoryToDelete;
System.Collections.IEnumerable listToDelete;
System.Collections.IEnumerator listEnumeratorToDelete;
CloudBlockBlob blobToDelete;
blobDirectoryToDelete = _blobContainer.GetDirectoryReference("File/ folder name");
listToDelete = new System.Collections.Generic.List<str>();
listToDelete = blobDirectoryToDelete.ListBlobs(false, 0, null, null);
listEnumeratorToDelete = listToDelete.getEnumerator();
while (listEnumeratorToDelete.moveNext())
{
blobToDelete = listEnumeratorToDelete.get_Current();
blobToDelete.DeleteIfExists(DeleteSnapshotsOption::None, null, null, null);
}
}
Thanks,
DAXBuddy
public void deleteFilesFromAzure(CloudBlobContainer _blobContainer)
{
CloudBlobDirectory blobDirectoryToDelete;
System.Collections.IEnumerable listToDelete;
System.Collections.IEnumerator listEnumeratorToDelete;
CloudBlockBlob blobToDelete;
blobDirectoryToDelete = _blobContainer.GetDirectoryReference("File/ folder name");
listToDelete = new System.Collections.Generic.List<str>();
listToDelete = blobDirectoryToDelete.ListBlobs(false, 0, null, null);
listEnumeratorToDelete = listToDelete.getEnumerator();
while (listEnumeratorToDelete.moveNext())
{
blobToDelete = listEnumeratorToDelete.get_Current();
blobToDelete.DeleteIfExists(DeleteSnapshotsOption::None, null, null, null);
}
}
Thanks,
DAXBuddy
No comments:
Post a Comment