How to find files and folders that have same names
How to find files and folders that have same names
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?
Re: How to find files and folders that have same names
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.
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.
Re: How to find files and folders that have same names
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.
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.
Re: How to find files and folders that have same names
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!
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!
Re: How to find files and folders that have same names
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?)
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?)
Re: How to find files and folders that have same names
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.
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.
-
- Posts: 2
- Joined: Tue Jan 28, 2020 6:37 am
Re: How to find files and folders that have same names
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 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.
Re: How to find files and folders that have same names
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.
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.
-
- Posts: 2
- Joined: Tue Jan 28, 2020 6:37 am
Re: How to find files and folders that have same names
If you would like to test fileexists:, please try the Everything 1.5 alpha.
Usage:
Specify a regex search with group captures, recall the group captures with \0-\9 in your fileexists: search.
For example, find mp3 files that also have a jpg file with the same stem in the same folder:
regex:^(.*)\.mp3 fileexists:\1.jpg
Use the path: search modifier on the regex search to capture full paths.
For example, find folders that have a jpg in the parent folder with the same name as folder:
path:folder:regex:^(.*)\\(.*)$ fileexists:\1.jpg
If the path: search modifier is omitted on the regex search term, the path of the current file/folder is used.
Usage:
Specify a regex search with group captures, recall the group captures with \0-\9 in your fileexists: search.
For example, find mp3 files that also have a jpg file with the same stem in the same folder:
regex:^(.*)\.mp3 fileexists:\1.jpg
Use the path: search modifier on the regex search to capture full paths.
For example, find folders that have a jpg in the parent folder with the same name as folder:
path:folder:regex:^(.*)\\(.*)$ fileexists:\1.jpg
If the path: search modifier is omitted on the regex search term, the path of the current file/folder is used.
Re: How to find files and folders that have same names
It's working, but after deleting jpg file, result list doesn't refresh...
Re: How to find files and folders that have same names
For certain functions, like dupe:, you have to effect a change to the search before it updates.
So if you change from:
regex:^(.*)\.mp3 fileexists:\1.jpg
to:
regex:^(.*)\.mp3 fileexists:\1.jpg.
(adding a .), then backspace, removing the dot, it will update.
So if you change from:
regex:^(.*)\.mp3 fileexists:\1.jpg
to:
regex:^(.*)\.mp3 fileexists:\1.jpg.
(adding a .), then backspace, removing the dot, it will update.
Re: How to find files and folders that have same names
The regex part is real-time, it's the fileexists: part that is not real-time.
For example, with:
regex:^(.*)\.mp3 fileexists:\1.jpg
adding or removing an mp3 will be in real-time.
adding or removing a jpg will not update your results in real-time. This is limitation with Everything.
As therube mentions, you can update your results by changing your search slightly.
Please try the following search if you are adding/removing jpg files:
regex:^(.*)\.jpg fileexists:\1.mp3
For example, with:
regex:^(.*)\.mp3 fileexists:\1.jpg
adding or removing an mp3 will be in real-time.
adding or removing a jpg will not update your results in real-time. This is limitation with Everything.
As therube mentions, you can update your results by changing your search slightly.
Please try the following search if you are adding/removing jpg files:
regex:^(.*)\.jpg fileexists:\1.mp3
Re: How to find files and folders that have same names
Ok, thanks for clarifications!