Achilles.Acme.Storage.Azure.AzureCloudStorageProvider.DeleteDirectory C# (CSharp) Метод

DeleteDirectory() публичный Метод

public DeleteDirectory ( string path, bool recursive ) : void
path string
recursive bool
Результат void
        public override void DeleteDirectory( string path, bool recursive )
        {
            // TJT: Needs to support non-recursive directory deletion

            if ( path == null )
                throw new ArgumentNullException();

            // TJT: Fixme..

            //if ( !IsValidDirectory( path ) )
            //    throw new ArgumentException();

            // cannot delete root directory
            if ( path == "/" )
                throw new ArgumentException();

            string prefix = GetAzurePath( path );
            bool useFlatBlobListing = true;

            // Supports recursive enumeration
            IEnumerable<IListBlobItem> allFiles = _blobClient.ListBlobs( prefix, useFlatBlobListing );

            foreach (var file in allFiles)
            {
                string uri = file.Uri.ToString();

                CloudBlockBlob b = _container.GetBlockBlobReference(uri);
                if (b != null)
                {
                    b.Delete();
                }
            }
        }