Command to find empty directories

Soldato
Joined
6 Sep 2016
Posts
10,844
Is there a way of displaying directories that have no files within them? Or under <100mb or so. I don't want them deleted, just shown as a list.

I installed foldersize (it's a windows that opens to the right of windows explorer) but it's not working for all directories, some which are full are showing 0kb, yet others which are empty show 0kb
 
Could the reason it (foldersize) is showing some full folders as 0kb be down to a permissions thing, are you running it with admin rights?

Not sure it fits the bill but you could use this powershell snippet...
Get-ChildItem 'C:' -Recurse | Where-Object { $_.PSIsContainer -eq $True } | Where-Object { $_.GetFileSystemInfos().Count -eq 0 } | Select-Object FullName
 
Is there a way of displaying directories that have no files within them? Or under <100mb or so. I don't want them deleted, just shown as a list.

I installed foldersize (it's a windows that opens to the right of windows explorer) but it's not working for all directories, some which are full are showing 0kb, yet others which are empty show 0kb
Could try this free software.

It will list all the empty folders and then give you the option to delete them all or some etc

 
Last edited:
Back
Top Bottom