List Only Files and Directories using Get-AzureStorageFile RRS feed

  • Question

  • Hi,

    I need to list only files in the Azure File Share and only  Directories. i Used the command like below

     Get-AzureStorageFile -Share (Get-AzureStorageShare -Name "xxx" -Context (New-AzureStorageContext $StorageAccountName $StorageAccessKey))

    when i execute above i get both files adn directories in my share

    is there a way i can get only files and only directories in the Share?




    Tuesday, September 19, 2017 6:01 PM


  • To list directories in a share use:

    Get-AzureStorageFile -ShareName "share1" | where {$_.GetType().Name -eq "CloudFileDirectory"}

    To list files in a directory use:

    Get-AzureStorageFile -ShareName "ContosoShare06" -Path "ContosoWorkingFolder" | Get-AzureStorageFile

    Reference: Get-AzureStorageFile

    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    • Edited by vikranth s Tuesday, September 19, 2017 7:05 PM
    • Proposed as answer by vikranth s Wednesday, September 20, 2017 10:37 AM
    • Marked as answer by sujith reddy komma Thursday, September 21, 2017 7:13 AM
    Tuesday, September 19, 2017 7:03 PM