Page 1 of 1

Properly quoting <file> for Quick Content Searches

Posted: 28 Sep 2016 18:34
by TheQwerty
I ran into an interesting scenario today where I'm trying to find files which contain another file's contents but are not duplicates.

For instance:
Match.txt contains "ABC/DEF"
Needle.txt contains "B"

Now, if I copy the contents into the Find Files > Contents tab I'm okay but I need to do this a couple dozen times and it sucks, so I thought I could use the quick search /contents switch combined with the <file> variable.

Thus I try:

Code: Select all

?/contents=<file C:\Files\Needle.txt>
Success!

On to the next file: Needle-Bad.txt contains "C/D"
Those results don't look correct - in fact that's everything containing 'C'. Oh right '/' means I need quotes:

Code: Select all

?/contents="<file C:\Files\Needle-Bad.txt>"
Nothing... how can that be?

HELP! /?

Code: Select all

Query:   /contents="<file C:\Files\Needle-Bad.txt>" /?
Parsed: name:"*"

Search: Quick Search
Mode: Auto
FindBoolSmartDetect: Yes
ExtendedPatternMatching: Yes
MasterInvert: No
Tags DB Only: No

Without quotes XY thinks it's a switch - with quotes and XY ignores <file...>.
What to do?
:?


(For now I guess I'll manipulate a search template but that is so ugly!)

Re: Properly quoting <file> for Quick Content Searches

Posted: 28 Sep 2016 19:20
by admin
TheQwerty wrote:On to the next file: Needle-Bad.txt contains "C/D"
Those results don't look correct - in fact that's everything containing 'C'. Oh right '/' means I need quotes:

Code: Select all

?/contents="<file C:\Files\Needle-Bad.txt>"
Nothing... how can that be?
Because it's a bug. Fix comes.

Nice code! :appl:

Re: Properly quoting <file> for Quick Content Searches

Posted: 28 Sep 2016 20:42
by TheQwerty
Fantastic - that's exactly what I was hoping you'd say! :P

There was a brief moment when I was considering requesting a new contents flag to achieve this (It's a file patch [Search for files containing its contents]), but I doubt it's something many others would need - even if it would be extremely useful for those that do. ;)