Exemplo n.º 1
0
        public static async Task <bool> DeleteBlobs(BlobDirectory dirInfo)
        {
            var continuationToken = dirInfo.NewBlobContinuationToken();

            do
            {
                var response = await dirInfo.ListBlobsSegmentedAsync(continuationToken);

                continuationToken = response.ContinuationToken;
                var results = response.Results;
                foreach (var item in results)
                {
                    var subdir = item.ToBlobDirectory();
                    if (!Object.ReferenceEquals(subdir, null))
                    {
                        await DeleteBlobs(subdir);
                    }
                    else
                    {
                        var file = item.ToBlockBlob();
                        await file.DeleteAsync();
                    }
                }
            }while (continuationToken != null);
            return(true);
        }
Exemplo n.º 2
0
        public static async Task <List <ICustomizedBlobItem> > ListBlobsAsync(BlobDirectory dirInfo)
        {
            var continuationToken = dirInfo.NewBlobContinuationToken();
            List <ICustomizedBlobItem> results = new List <ICustomizedBlobItem>();

            do
            {
                var response = await dirInfo.ListBlobsSegmentedAsync(continuationToken);

                continuationToken = response.ContinuationToken;
                results.AddRange(response.Results);
            }while (continuationToken != null);
            return(results);
        }