Sublime Forum

Exclude binary files from search

#1

Hey guys, I’m not sure if it’s something that has changed lately or I just didn’t noticed until now, but the search in project feature is also searching through binary files:

C:\work\projects\xxx\wp-content\uploads\sites\3\ninja-forms\tmp\FCGWE\ninja_forms_field_9:
    <binary>

C:\work\projects\xxx\wp-content\uploads\sites\3\ninja-forms\tmp\g87Ab\ninja_forms_field_9:
    <binary>

C:\work\projects\xxx\wp-content\uploads\sites\3\ninja-forms\tmp\Kt5rP\ninja_forms_field_9:
    <binary>

Since these are useless by any means, they can be excluded from search?

Thanks!

0 Likes

#2

There is a setting called binary_file_patterns which is supposed to mask files from Goto Anything and Find in Files, and the default setting is:

// These files will still show up in the side bar, but won't be included in
// Goto Anything or Find in Files
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],

You could amend it so that it matches the files you want to exclude, or possibly add something like (untested) “,-/tmp/” to the Where field of the search so that it doesn’t go into that directory at all.

On the other hand, while checking this I noticed that even though the default setting includes “*.png”, I can still do a Find In Files on my web project directory and have it hit png files in the images directory, so I’m not sure if that’s a bug or I’m just misunderstanding what this option is supposed to do.

0 Likes

#3

Yeah, I’m aware of that, but it seems that the pattern is kind of ignored…

0 Likes

#4

This issue may be related Binary_file_patterns does't work in Sublime3 3083 on folders
I am a big fan os “binary_file_patterns” since it’s useful to exclude vendor files and folders (which I still need to list in the sidebar). Not sure there’s a new file search feature on planning, but Sublime seems to keep ignoring the property.

1 Like