findstr command to filter out files with given extension
- Sean O'Shea
- Feb 7, 2020
- 1 min read
If you want to get a list of all of the files in a directory other than those with a given file extension you can do so using the findstr command with a /vi switch.
dir | findstr /v ".pdf"
The dir command feeds in a directory list to the findstr search command and the /v switch filters the data with the value listed in quotes.
In this example the 'MyData' folder has 10 pdf files which are excluded from the list that is generated.

Recent Posts
See AllWhen using robocopy command in Windows to copy files, note that if you are an admin you can use the /B switch to copy files from...