App to find empty folders on a drive


Sigurd

Well-known member
Member
VIP
Local time
7:39 AM
Posts
500
OS
Windows 11 - Updated automatically
I have tried various ways to do this without success. I won't go into all the ways. Suffice to say they either don't work, are too old, or part f an expensive app with functions I don't need.
Any suggestions appreciated.
 

My Computer

System One

  • OS
    Windows 11 - Updated automatically
    Computer type
    PC/Desktop
    Manufacturer/Model
    Updated Chillblast
    CPU
    Intel i7 12700K Twelve Core 3.6Ghz
    Motherboard
    MSI PRO Z690-A DDR4 Motherboard
    Memory
    Corsair 32Gb Vengeance RAM
    Cooling
    Air cooled
    Internet Speed
    72Mb down, 18Mb up
    Browser
    Chrome
    Antivirus
    Avast
If you're comfortable with PowerShell, this would clean out the user's Temp directory, for example. Run it as-is to see what would be removed; take out the -WhatIf to actually remove things.

Powershell:
function Remove-EmptyFolders
{
    param
    (
        [string]$Path
    )

    if (Test-Path $Path)
    {
        Get-ChildItem -Path $Path -Force -Directory | ForEach-Object { Remove-EmptyFolders $_.FullName }

        Get-ChildItem $Path -Force | Measure-Object |
        ForEach-Object {
            if ($_.Count -eq 0)
            {
                Remove-Item -Path $Path -ErrorAction SilentlyContinue -WhatIf
            }
        }
    }
}

Remove-EmptyFolders -Path $env:Temp
 

My Computer

System One

  • OS
    Windows 11 Pro 25H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Core i7-1260P
    Motherboard
    NUC12WSBi7
    Memory
    64 GB Micron PC4-25600
    Graphics Card(s)
    Intel Iris Xe Graphics
    Sound Card
    on-board Realtek HD Audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840 x 2160
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Crucial MX500 2 TB
    Antivirus
    Microsoft Defender
This seems to be accurate if you're using Everything, but remember it's only as accurate as the Everything index.

Background info here and here.

Code:
"C:\Some\Path\Here" childcount:=0
 

My Computer

System One

  • OS
    Windows 11 Pro 25H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Core i7-1260P
    Motherboard
    NUC12WSBi7
    Memory
    64 GB Micron PC4-25600
    Graphics Card(s)
    Intel Iris Xe Graphics
    Sound Card
    on-board Realtek HD Audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840 x 2160
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Crucial MX500 2 TB
    Antivirus
    Microsoft Defender
Back
Top Bottom