How to find files and folders that have same names

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
dylemat1
Posts: 1
Joined: Sun Apr 07, 2019 9:20 pm

How to find files and folders that have same names

Post by dylemat1 » Sun Apr 07, 2019 9:24 pm

Hello! My problem is that I have lots of folders with extracted files and original archives which I want to delete, both archives and folders, have the same names (after extract to ... feature). How to find them?

void
Site Admin
Posts: 6067
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to find files and folders that have same names

Post by void » Mon Apr 08, 2019 2:20 am

Please try the following search:
regex:\\([^\\]*)\\\1\.[^\\]*$

If you only want zip files with the same stem name as the parent folder, please try searching for:
regex:\\([^\\]*)\\\1\.zip
-or-
regex:\\([^\\]*)\\\1\.[^\\]*$ ext:zip;rar

\\ = a single literal \
( ) = capture match and store it in variable 1
[^\\]* = match anything except \ any number of times
\1 = match the same thing that was matched inside ( and )
\. = a single literal .
[^\\]* = match anything except \ any number of times.
$ = match the end of the filename.

therube
Posts: 2852
Joined: Thu Sep 03, 2009 6:48 pm

Re: How to find files and folders that have same names

Post by therube » Mon Apr 08, 2019 11:07 am

That will also match a filename that also uses the same name in its' path.
So filename + path; c:/tmp/123/123.txt matches (itself, if you will) because /123/ (path) & /123 (filename) match.

Similarly, note that everything up to the first (.) is name & everything after the first (.) is treated as the extension.
So, 02-3QT.NEW.ARJ & 02-3QT.OLD.ARJ also match; 02-3QT = 02-3QT.

vanisk
Posts: 152
Joined: Sat Oct 27, 2018 11:33 am

Re: How to find files and folders that have same names

Post by vanisk » Mon Apr 08, 2019 11:29 am

I tested all 3 regex and found that it finds, for example
Media.zip inside a folder named Media

But OP is looking for is kinda different (to my understanding)
for example
X:\Media\
X:\Media.zip


Usually on extracting a zip file using context "Extract to", it uses the same name as of Zip. OP is looking for archive and its extracted folder, so we can delete either one or both!

therube
Posts: 2852
Joined: Thu Sep 03, 2009 6:48 pm

Re: How to find files and folders that have same names

Post by therube » Mon Apr 08, 2019 11:48 am

AllDup has the option to scan within "zip" (archive) files.
So can find files that match both extracted & within the zip.


1. is duplicate names, 2. is name & size.
https://i.postimg.cc/Q8pg6LXs/All-Dup-Z ... arison.png

Similarly you could use any type of duplicate check offered, hash, date..., filtering...

Note that with a name dup, Messages.js matches messages.json.
(You can also tell it to include the extension in which case those two names would not match).

Similarly, oddly if you will, with a name dup, places.sqlite, places.sqlite-shm, & places.sqlite-wal all also match.
(They do not show up in 2., when comparing name+size.)


Now by default the entire directory tree would be searched, so it could be that you had the same named file, totally unrelated, elsewhere in the tree that would also match a name from within the zip. name+size, might rule that out. name+size+hash, certainly would.


Or you could use either method as a starting point for further detailed inquiry.


Duplicate Cleaner also has some sort of "zip" search too.
AllDup is free. DuplicateCleaner has both free & pay versions.
Prior to now, I've never looked at the zip feature in either program, & still have not in DC at all.

Deleting the duplicate files from with the zip with alldup, ended up deleting all the files from within the zip, but left the zip itself (a few thousand bytes), but "empty" inside. (Not sure if it has the option to delete that "empty" zip too?)

NotNull
Posts: 2687
Joined: Wed May 24, 2017 9:22 pm

Re: How to find files and folders that have same names

Post by NotNull » Mon Apr 08, 2019 12:04 pm

Take a look here.

void
Site Admin
Posts: 6067
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to find files and folders that have same names

Post by void » Mon Apr 08, 2019 12:22 pm

I'm looking into ways to add this functionality...

Something like the following could be useful:
regex:^(x:\\[^\\]*)\.zip$ folderexists:\1
-This would show files when a folder matches the same name without the .zip

regex:^(x:\\[^\\]*)$ fileexists:\1\.zip
-This would show folders when a file matches the same name with the .zip

You could or these searches together to find both.

everything_user
Posts: 2
Joined: Tue Jan 28, 2020 6:37 am

Re: How to find files and folders that have same names

Post by everything_user » Tue Jan 28, 2020 6:43 am

void wrote:
Mon Apr 08, 2019 12:22 pm
I'm looking into ways to add this functionality...

Something like the following could be useful:
regex:^(x:\\[^\\]*)\.zip$ folderexists:\1
-This would show files when a folder matches the same name without the .zip

regex:^(x:\\[^\\]*)$ fileexists:\1\.zip
-This would show folders when a file matches the same name with the .zip

You could or these searches together to find both.
Hi, Is there any update to this? I tried the above regex examples but they don't work? I have the same problem, trying to detect folders that have the same name as a Zip file when someone has extracted a zip file to a folder of the same name, and left the zip behind...

void
Site Admin
Posts: 6067
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to find files and folders that have same names

Post by void » Tue Jan 28, 2020 10:46 am

It's implemented for the next major version. No release date yet sorry.

Basic syntax will be:
path:regex:^(.*)\.mp3 fileexists:\1.jpg
-matches mp3 files that have a jpg file with the same stem.

The fileexists: search function must take a full path and filename as a parameter. \1 - \9 can be used to substitute regex matches.
path:regex: will force the regular expression to capture the entire path.

everything_user
Posts: 2
Joined: Tue Jan 28, 2020 6:37 am

Re: How to find files and folders that have same names

Post by everything_user » Tue Jan 28, 2020 1:07 pm

void wrote:
Tue Jan 28, 2020 10:46 am
It's implemented for the next major version. No release date yet sorry.
That's fine thanks, i'll look forward to the next version :)

Post Reply