- 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 exclude specific file names using Get-ChildItem in PowerShell?
To exclude specific file(s) from being displayed in the output of Get- ChildItem, you need to specify the file name(s).
Command
Get-ChildItem D:\Temp\ -Recurse -Exclude style.css, LGPO.exe
Output
Directory: D:\Temp\LGPO Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 01-06-2017 02:25 638115 LGPO.pdf Directory: D:\Temp Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 07-05-2018 23:00 301 cars.xml -a---- 29-12-2017 15:16 4526 healthcheck.htm -a---- 29-12-2017 15:16 4526 healthcheck1.htm -ar--- 13-01-2020 18:19 0 Readonlyfile.txt -a---- 08-12-2017 10:24 48362 servicereport.htm -a---- 08-12-2017 10:24 48362 servicereport1.htm -a---- 12-12-2017 23:04 1034 tes.htmoutput.htm -a---- 08-12-2017 11:29 7974 Test.xlsx -a---- 25-10-2017 08:13 104 testcsv.csv
You can also use the wildcard characters to exclude files.
Get-ChildItem D:\Temp\ -Recurse -Exclude LG*
The above command will exclude all the files and folders starting with LG.
Advertisements