PowerShell: List Empty Dir 🚀
List Empty Directories
function xah-list-empty-dir { # .DESCRIPTION # list empty dirs in current dir, recursively # .NOTES # Version: 2022-03-03 2023-08-17 # .LINK # http://xahlee.info/powershell/powershell_list_empty_dir.html Get-ChildItem -Directory -Recurse | Where-Object { $_.GetFileSystemInfos().Count -eq 0 } }
Delete Empty Directories
function xah-delete-empty-dirs { # .DESCRIPTION # delete empty dirs in current dir, recursively # .NOTES # Version: 2022-12-12 2024-05-03 # .LINK # http://xahlee.info/powershell/powershell_list_empty_dir.html $empdirs = Get-ChildItem -Directory -Recurse | Where-Object { $_.GetFileSystemInfos().Count -eq 0 } Write-Host "Deleting:" $empdirs | ForEach-Object { $_.fullname } | Out-Host $empdirs | Remove-Item -Confirm }
PowerShell. List Dirs and Files
List Dirs
- PowerShell: Navigate Directory
- PowerShell: Show Current Dir Path
- PowerShell: List Directories
- Show Directory as Tree
- PowerShell: List Empty Dir 🚀
- PowerShell: Dir Size 🚀
List Files
- PowerShell: List Files
- PowerShell: Show Fullpath, No Truncate Lines
- PowerShell: List Empty Files
- PowerShell: Count Number of Files
- PowerShell: List Files by Name Pattern
- PowerShell: Filter File Name by Regular Expression
- PowerShell: List File by Size
- PowerShell: Sort Files by File Size 🚀
- PowerShell: List Files by Date Time
- PowerShell: Search Text in Files (grep)