Skip to content

Instantly share code, notes, and snippets.

@AdamNaj
Created May 13, 2021 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamNaj/bf0d4928602726e19e9dacffc46db95d to your computer and use it in GitHub Desktop.
Save AdamNaj/bf0d4928602726e19e9dacffc46db95d to your computer and use it in GitHub Desktop.
Show report of empty folders in Sitecore Media library
$source = Get-Item "master:\media library"
$readonly = $false;
$result =
Read-Variable `
-Parameters @{ Name = "root"; Title="Root folder"; Root="/sitecore/media library"; editor="item"} `
-Title "Find Empty Folders" `
-Description "Select the location you want to inspect." `
-OkButtonName "Clone"
if ($result -eq "ok") {
gci -Path $root.ProviderPath | ? { $_.TemplateName -eq "Media Folder" } | ? { $_.Children.Count -eq 0 } | Show-ListView
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment