Created
October 4, 2022 08:43
-
-
Save joanteixi/9161d4c2b3a11ff507515f4c807ce4b7 to your computer and use it in GitHub Desktop.
Azure Storage get size by folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run first "connect-azAccount" to set AAD user authentication | |
$filesystemName = 'storageFilesystem' | |
$path = 'folder' | |
$storageName = 'storagName' | |
$ctx = New-AzStorageContext -StorageAccountName $storageName -UseConnectedAccount | |
$Files = Get-AzDataLakeGen2ChildItem -Context $ctx -FileSystem $filesystemName -Path $path -Recurse | Where-Object IsDirectory -eq $false | |
$Total = $Files | Measure-Object -Property Length -Sum | |
$Total | Select-Object @{Name = "SizeInGb"; Expression={$_.Sum/1GB}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment