Search other files and folders based on first x characters of a given file name

Discussion related to "Everything" 1.5.
Post Reply
eswul62
Posts: 167
Joined: Wed Jul 31, 2013 6:07 am

Search other files and folders based on first x characters of a given file name

Post by eswul62 »

Maybe I am overlooking the solution, maybe it just isn't possible yet, I vainly searched for a solution for the following:

Example - whilst organizing files/folders.

In Explorer/Directory Opus, say I have a file name titled: file name xyz blah blah ... pdf

Based on the first part of that file I need to find -other- files and folders.
So, other files/folders starting with the first same characters, let's say first 10-12 characters or so.

My steps right now : 1) select file, 2) hit f2, 3)select fist words/characters, 4)ctrl-c, 5)escape, 6)paste clipboard in Everything search box.

Q: Would there be a command line instruction to do this (based on first 12 characters)?

(BTW - am facing the below issue on a very regular basis)

Thanks.
void
Developer
Posts: 19870
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search other files and folders based on first x characters of a given file name

Post by void »

regex:(.{12}) add-column:1 dupe:1


regex: = enable regular expressions.
( ) = capture group - Regular Expressions Match 1
.{12} = match 12 characters.
add-column:1 = show the captured text. (optional)
dupe:1 = find files with the same captured text.

regex:
add-column:
dupe:
eswul62
Posts: 167
Joined: Wed Jul 31, 2013 6:07 am

Re: Search other files and folders based on first x characters of a given file name

Post by eswul62 »

Thanks a lot!
Will check and get back on this soonest.
(Have to go out now)
puzzle
Posts: 2
Joined: Mon Mar 03, 2025 9:07 pm

Re: Search other files and folders based on first x characters of a given file name

Post by puzzle »

void wrote: Mon Dec 09, 2024 5:29 am
regex:(.{12}) add-column:1 dupe:1
I'm confused, your example works, but If I want to grab the whole name and add an extention it doesn't.
regex:(.+)\.rar add-column:1 dupe:1

Should be the same logic.
Last edited by puzzle on Mon Mar 03, 2025 9:27 pm, edited 2 times in total.
NotNull
Posts: 5961
Joined: Wed May 24, 2017 9:22 pm

Re: Search other files and folders based on first x characters of a given file name

Post by NotNull »

".rar" does not necessarily mean that it's the extension. The following files would be matched too:

I.love.rare.earth.magnets.txt
archive.rar.lnk

What exactly are you trying to find and show in the resultlist?
puzzle
Posts: 2
Joined: Mon Mar 03, 2025 9:07 pm

Re: Search other files and folders based on first x characters of a given file name

Post by puzzle »

NotNull wrote: Mon Mar 03, 2025 11:04 pm ".rar" does not necessarily mean that it's the extension. The following files would be matched too:
The thing is they don't, at all, even if you add $ at the end like so
regex:(.+)\.rar$ add-column:1 dupe:1

it still doesn't show any matches.
Same as the ts I was trying to find files and folders that share the same base name (without extension) as any .rar files in the directory to find duplicates.
This is not the real task though, I was just playing around to see if I could solve something non-trivial using only this app.
NotNull
Posts: 5961
Joined: Wed May 24, 2017 9:22 pm

Re: Search other files and folders based on first x characters of a given file name

Post by NotNull »

Non-trivial is on the menu too :D
puzzle wrote: Mon Mar 03, 2025 11:24 pm to find files and folders that share the same base name (without extension) as any .rar files in the directory to find duplicates.

Code: Select all

dupe:path   exact:fileexists:$stem:.rar
NotNull
Posts: 5961
Joined: Wed May 24, 2017 9:22 pm

Re: Search other files and folders based on first x characters of a given file name

Post by NotNull »

Maybe this is the regex query you were looking for?

Code: Select all

regex:^(.+)\.rar$ add-column:1 dupe:1
(as said: be as precise and specific as possible in describing what you want and what the results should look like...)
eswul62
Posts: 167
Joined: Wed Jul 31, 2013 6:07 am

Re: Search other files and folders based on first x characters of a given file name

Post by eswul62 »

Many thanks indeed.
All these dupe-checks show that I have to do a -lot- of cleanups! ;)
Post Reply