Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Findstr -- exclude a file type -- search only ascii [closed]

I want to run a FINDSTR dos command in a way beyond what it is easily found in "findstr /?". How would I run findstr so that it only searches ascii files. (I am not sure if that is possible. My gut feeling is that it is not possible) Additionally, how would I run this command line so that it would exclude some file times. For example, what if I wanted to exclude .psd files

like image 685
xarzu Avatar asked Feb 18 '23 17:02

xarzu


1 Answers

What is wrong with the /P option that is described in the help?

/P         Skip files with non-printable characters.

It worked for me.

To take further control of which files are searched, simply iterate the files with a for loop and add whatever logic you need. To skip .psd files and also skip binary files:

for /f "eol=: delims=" %%F in ('dir /a-d /b^|findstr /live ".psd"') do findstr /p "search" "%%F"

Use a single percent instead of double percents if run from the command line.

like image 186
dbenham Avatar answered Feb 20 '23 15:02

dbenham