从Azure门户

时间:2017-02-10 05:31:50

标签: azure azure-storage azure-storage-blobs blobstorage

我是Azure DatabaseDB的新手,我想检查上传到blob存储的文件,并从portal.azure.com逐个删除。

是否可以查看列表并从portal.azure.com删除它?

  

注意:我只想删除存储在blob存储中的文件,而不是   blob存储。

2 个答案:

答案 0 :(得分:1)

我找到了解决方案。

点击Storage Account - >点击Containers =>选择Container =>点击File =>最后Delete

谢谢。

答案 1 :(得分:1)

您也可以使用C#代码 -

private CloudBlobContainer blobContainer;

public void DeleteFile(string uniqueFileIdentifier)
{
  this.AssertBlobContainer();

  var blob = this.blobContainer.GetBlockBlobReference(fileName);
  blob.DeleteIfExists();
}

private void AssertBlobContainer()
{
// only do once
if (this.blobContainer == null)
{
    lock (this.blobContainerLockObj)
    {
        if (this.blobContainer == null)
        {
            var client = this.cloudStorageAccount.CreateCloudBlobClient();

            this.blobContainer = client.GetContainerReference(this.containerName.ToLowerInvariant());

            if (!this.blobContainer.Exists())
            {
                throw new CustomRuntimeException("Container {0} does not exist in azure account", containerName);
            }
        }
    }
}

if (this.blobContainer == null) throw new NullReferenceException("Blob Empty");
}