SalimAzureBlobAPI/SalimAzureAPI/AzureBlobManager.cs
/// <summary>
/// Removes a "virtual" blob directory. For a directory to be removed, 
/// every single blob file must also be removed. 
/// So this will remove all the blobs within this directory. Make sure that's what you want!
/// </summary>
/// <param name="containerName">The container containing the directory.</param>
/// <param name="directoryName">The virtual directory to remove.</param>
/// <returns></returns>
Removes a "virtual" blob directory. For a directory to be removed,
every single blob file must also be removed.
So this will remove all the blobs within this directory. Make sure that's what you want!
Removes a " virtual " blob directory . For a directory to be removed every single blob file must also be removed . So this will remove all the blobs within this directory . Make sure that ' s what you want!
public bool DeleteBlobDirectory(string containerName, string directoryName)
        {
            return ExecuteWithExceptionHandlingAndReturnValue(
                    () =>
                    {
                        CloudBlobContainer container = _blobClient.GetContainerReference(containerName);
                        Parallel.ForEach(container.ListBlobs(directoryName, false), item =>
                        {
                            if (item.GetType() == typeof(CloudBlob) || item.GetType().BaseType == typeof(CloudBlob))
                            {
                                ((CloudBlob)item).Delete();
                            }
                        }
                        );
                    });
        }
public bool DeleteBlobDirectory ( string containerName , string directoryName ) { return ExecuteWithExceptionHandlingAndReturnValue ( ( ) => { CloudBlobContainer container = _blobClient . GetContainerReference ( containerName ) ; Parallel . ForEach ( container . ListBlobs ( directoryName , false ) , item => { if ( item . GetType ( ) == typeof ( CloudBlob ) || item . GetType ( ) . BaseType == typeof ( CloudBlob ) ) { ( ( CloudBlob ) item ) . Delete ( ) ; } } ) ; } ) ; }
Removes a "virtual" blob directory.
Removes a " virtual " blob directory .
//foreach (IListBlobItem item in container.ListBlobs(directoryName,false)) //return true;
None
containerName
string
The container containing the directory.
The container containing the directory .
directoryName
string
The virtual directory to remove.
The virtual directory to remove .