Properly quoting <file> for Quick Content Searches

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Properly quoting <file> for Quick Content Searches

Post 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!)

admin
Site Admin
Posts: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Properly quoting <file> for Quick Content Searches

Post 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:

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Properly quoting <file> for Quick Content Searches

Post 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. ;)

Post Reply