Sublime Forum

Exclude all binary files from search

#1

Edit: Is it possible to exclude all binary files from “find-in-files” search, regardless of their name and their location?


Hello,

My project contains binary files all over the place, without an explicit filename patterns to identify them, and without file extension in their names.

Is it possible to exclude those files from the search? Since they are pretty big and seems to slow down the search process very significantly.

It seems possible, since sublime does present those files as <binary> in the find results, but I couldn’t find any setting for that.

Another proof for this being doable, is the grep command in Linux which is capable of ignoring binary files (by default) without caring about the file name.

Thank you for your time,
Have a nice day :wink:

0 Likes

#2

Bump. I simplified the question hoping to get an answer.

0 Likes

#3

I take it you have also have some non-binary files with no extension, otherwise you’d just add *. to your binary_file_patterns preferences, right? it’s possible to write a plugin to filter out the binary files after the search has completed, but then you’d get no performance improvement… The way ST knows if files are binary are not is generally to check if they contain a null character - it’d still have to search the file to find one though, so not sure how performance would be affected. I guess grep does the same thing?

0 Likes

#4

Thank you @kingkeith for your response :slight_smile:

I tried putting that into binary_file_patterns but it didn’t seem to make any effect. Is there a mistake in that pattern perhaps?

Edit: It seems that I need a “negative” pattern, to match all files that does not have extension. I can’t figure out how to do this with wildcard. And I suppose that Regex is not supported in binary_file_patterns.

0 Likes