コード例 #1
0
        private static void ListBlobs(ContainerHelper containerHelper)
        {
            string containerName;

            ListContainers(containerHelper);
            Console.Write("Enter the container name you want to list the blob in: ");
            containerName = Console.ReadLine();
            if (containerHelper.ContainerExists(containerName))
            {
                var blobs = containerHelper.GetBlobs(containerName);
                Console.WriteLine();
                if (blobs?.Count() == 0)
                {
                    Console.WriteLine("Container is empty");
                }
                else
                {
                    foreach (var blob in blobs)
                    {
                        Console.WriteLine($"Name: {blob.Name}, Type: {blob.Properties.BlobType}, Tier: {blob.Properties.AccessTier}, Size: {blob.Properties.ContentLength} Bytes");
                    }
                }
            }
            else
            {
                Console.WriteLine($"No container is named {containerName}");
            }
        }
コード例 #2
0
 private static void DownloadContainerBlobs(ContainerHelper containerHelper, string containerName, string localFolder)
 {
     if (containerHelper.ContainerExists(containerName))
     {
         var blobs = containerHelper.GetBlobs(containerName);
         foreach (var blob in blobs)
         {
             Console.WriteLine($"Downloading {blob.Name}");
             containerHelper.DownloadBlob(containerName, blob.Name, Path.Join(localFolder, blob.Name));
             Console.WriteLine($"{blob.Name} downloaded to {Path.Join(localFolder, blob.Name)}");
         }
     }
 }