- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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} }
Advertisements