top of page

findstr command to filter out files with given extension

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.

bottom of page