

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the list of empty folders using PowerShell?
To get the list of empty folder on the windows OS using PowerShell, we can use the below method.
gci C:\Temp -Recurse | foreach { if( $_.psiscontainer -eq $true){ if((gci $_.FullName) -eq $null){$_.FullName} } }
The above command checks the C:\Temp folder and its subfolders and if the content is empty it returns the Folder full path. The PSISContainer property stands for the folder and GCI is the alias of the Get-ChildItem command. We can alternatively use the below command, instead of using the PSISContainer property.
gci C:\Temp -Recurse -Directory | foreach { if((gci $_.FullName) -eq $null){$_.FullName} }
- Related Questions & Answers
- How to get the list of shared folders using PowerShell?
- How to delete empty files and folders using PowerShell?
- How to get hidden files and folders using PowerShell?
- How to get only files but not the folders with Get-ChildItem using PowerShell?
- How to get the list of local groups using PowerShell?
- How to get empty files in Windows OS using PowerShell?
- How to get only hidden files and folders in PowerShell?
- How to get only folders but not the files in the Get-ChildItem in PowerShell?
- How to Zip / Unzip files or folders using PowerShell?
- How to retrieve files and folders attributes using PowerShell?
- How to change files and folders attributes using PowerShell?
- How to delete hidden files and folders using PowerShell?
- How to list the subfolder contents using Get-ChildItem using PowerShell?
- How to display files/folders including hidden files/folders in PowerShell?
- How to check if the file is empty using PowerShell?
Advertisements