# How To Find Empty Folders With PowerShell

**URL:** <https://onehack.st/t/how-to-find-empty-folders-with-powershell/217233>\
**Category:** Tutorials & Methods\
**Tags:** freebies, tips-tricks, windows, file-management\
**Created:** [March 24, 2022, 9:52pm UTC](https://onehack.st/t/how-to-find-empty-folders-with-powershell/217233 "2022-03-24T21:52:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![WhiteHat](https://onehack.st/user_avatar/onehack.st/whitehat/32/162514_2.png) [@WhiteHat](https://onehack.st/u/WhiteHat)\
**Post date:** [March 24, 2022, 9:52pm UTC](https://onehack.st/t/how-to-find-empty-folders-with-powershell/217233/1 "2022-03-24T21:52:45Z")

</div>

1. Open the Microsoft PowerShell ISE → Using an admin account that has full access to your file share, run the following script on the workstation, specifying the network path of the shared drive:

```auto
$share = Get-ChildItem '\\pdc\Shared' -Recurse | Where { $_.PsIsContainer -eq $true }

$share | Where { $_.GetFiles().Count -eq 0 -and $_.GetDirectories().Count -eq 0 }

```

1. Review the results.  
 ![image](https://onehack.st/uploads/default/original/3X/7/a/7af5241c17cdb0fc6448109444a400c13823de8d.png)

**Enjoy!**
