Share via


How to do right pattern search in File Explorer?

Question

Sunday, May 7, 2017 10:06 PM

I want to find file copies, which are named as XXX (1).jpg, XXX (2).jpg, etc.

But when I use mask search as follows: name:=(1).jpg - i get also false matches included, where 1 is occured anywhere, moreover - ( ) are ignored in some cases. How to make pattern right?

All replies (10)

Sunday, May 7, 2017 11:14 PM

Well not an answer but a work-around.

https://mythicsoft.com/filelocatorlite


Tuesday, May 9, 2017 6:59 AM

Hi Alexandis,

If you want to search for specific file's copies for example "test.jpg", I think we should search for "name:=(test).jpg".

Best regards

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].


Tuesday, May 9, 2017 9:53 PM

I don't think it fits my bill: I have thousands of files, named IMG_XXXX.jpg / IMG_XXXX.png.

And some of them have duplicates like IMG_XXXX (1), IMG_XXXX (2) and so on...

It's not one specific file like test.jpg.

And from what I can see, Windows Explorer search does not work properly: if finds all occurrences of character in the brackets in any position, ignoring the brackets themselves. Maybe I miss some patterns, but whether I only must use 3rd party file explorer tools, like mentioned above FileLocator?


Tuesday, May 9, 2017 11:18 PM

Well to me the Windows search tries too hard imho. I have seen this from the Windows 7 file search and beyond into other systems (Outlook \ Exchange). Not its fault per se but the searches still dreams of WinFS and the current file based system lacks. Oh an I did not mention Everything previously, but I can do a *(*)* in that and it finds all the files with open and closed brackets on my system.


Wednesday, May 10, 2017 12:38 AM

But when I use mask search as follows: name:=(1).jpg - i get also false matches included, where 1 is occured anywhere, moreover - ( ) are ignored in some cases. How to make pattern right?

I think  name:~>(1).jpg  would be closer to what you are looking for but I'm not sure about the syntax implications for the parentheses.  You could create a Search shortcut with one and then find out how it is being treated.

Heh.  This works:   name:"(1).exe"   So does this:  name:"?1?.exe"

Strangely this doesn't?  name:"(?).exe"   I imagine that would be the preferred syntax for your requirement if it would work.

Note the double quotes.  Here's why (but looks like there is a documentation error?)

https://msdn.microsoft.com/en-us/library/windows/desktop/bb266512(v=vs.85).aspx 

COP_DOSWILDCARDS

~

System.FileName:~"Mic?osoft W*d"

Finds files where the file name starts with Mic, followed by some character, followed by osoft w, followed by any characters ending with d.

 
E.g. try inserting the prescribed tilde into each of the above tests and see nothing?

However, who knows how the File Explorer parser is translating the user's typing into the syntax to be sent to the search engine?  That's why you should create a search shortcut and find out.

 

HTH

Robert Aldwinckle


Friday, May 12, 2017 7:03 PM

Hi,

i've tried double quotes and here's the result:

name:"(2).jpg"

results:

IMG_0096 (2).JPG - great

pic for cv 2.jpg - OOPS!

IMG_2090_2.jpg - OOPS again!

I wonder why File Explorer does not support regular expressions out of the box! That would make life easier...


Friday, May 12, 2017 9:27 PM

I wonder why File Explorer does not support regular expressions out of the box!

Then why not use PowerShell?  No need for third-party search tools provided you are willing to use a command shell instead of a GUI (which is forcing you to act as if you were using a command shell anyway.)  Then with it you could do as little as  dir "*(?).jpg"  That's not a Regular Expression but it would do what you want at least for a single digit pattern.  The Help (Get-Help dir -ShowWindow) explains that we can use "wildcards".  I think in order to use a more precise Regular Expression you might have to pipe a partial match, say  "*.jpg" to a Where-Object filter which would allow more precision.

Ref.
https://technet.microsoft.com/en-us/library/ff730947.aspx?f=255&MSPPError=-2147217396 

(BING search for
    file list regular expression powershell
)

 

FYI

Robert Aldwinckle


Saturday, May 13, 2017 8:50 AM

Well, maybe it's time to become a console guy instead of GUI guy :)

I am a programmer, but in daily routine got used to use quick ready-to-use tools, which produce quick obvious result :)

Ok, i got the point. So to use regular expression, I will have to try 3rd party tool.

Thanks!


Saturday, September 29, 2018 7:49 PM

You can use    "*(1).*" to list all of the files that have a (1) in the name. 


Sunday, September 30, 2018 1:35 AM

Use: name:~"*(*).jpg" in the Search Bar:

Keith

Keith