Show exactly one copy of each filename?

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
Twilight
Posts: 1
Joined: Sat Oct 26, 2019 12:26 pm

Show exactly one copy of each filename?

Post by Twilight »

I often need to find out how many unique files there are in certain directories that include duplicate files.
Is there a way to do this?
Duplicate files will always have the same name.
I've tried looking through the commands but couldn't find anything that could do this.
therube
Posts: 4955
Joined: Thu Sep 03, 2009 6:48 pm

Re: Show exactly one copy of each filename?

Post by therube »

dupe: works "globally".

You could !dupe: (not dupe) & give it a particular path, which might give you an approximation of what you are looking for?

You could set up a File List for your particular tree, & do a !dupe: on that (likely to be more "accurate", but still not really).

!dupe: O:\moved_\


That might show...


Actually, that may do what you want... no, not exactly.

Where it would fail, is if the file is "unique" to the particular path you've specified - but, is also, elsewhere, outside of that path.
Say the file is "LAST SESSION_U.INI.TXT" & that file is in "O:\moved_\LAST SESSION_U.INI.TXT" & is actually unique.
The !dupe: (from above) will show that file.
Now if you then copy that file, say to "C:\LAST SESSION_U.INI.TXT", at that point (& after having "refreshed" the !dupe: function [as it does not automatically refresh]), then LAST SESSION_U.INI.TXT will no longer turn up - because it is no longer unique, it does exist elsewhere, just outside of your filtered location (O:\moved_|) [& again, dupe: works globally].


In any case, depending on your particular situation, particular data set, !dupe: may be sufficient for your needs.
therube
Posts: 4955
Joined: Thu Sep 03, 2009 6:48 pm

Re: Show exactly one copy of each filename?

Post by therube »

Code: Select all

DIR \B  PATH1  >  lookforuniq.txt
DIR \B  PATH2 >>  lookforuniq.txt
DIR \B  PATH3 >>  lookforuniq.txt
SORT  lookforuniq.txt  >  lookforuniq2.txt
UNIQ -u  lookforuniq2.txt  >  UNIQ.TXT
You would need a "uniq" command.
It would be found in coreutils-5.3.0-bin.zip at https://sourceforge.net/projects/gnuwin32/files/.
Additionally, you would need, coreutils-5.3.0-dep.zip, found at the same place.

uniq.exe & two dependencies (.dll's) are found in the respective archives /bin/ directories.
Place uniq.exe & the two .dlls, somewhere, in your path, or in the same directory that your run the commands from, or...
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Show exactly one copy of each filename?

Post by NotNull »

therube wrote: Mon Oct 28, 2019 3:42 pm Actually, that may do what you want... no, not exactly.
Actually ... that is a good solution! (I think):
  • Search for:

    Code: Select all

    "C:\folder 1"|"X:\folder 2"|"T:\folder 3"
  • Exprort the results as an EFU file (Menu;File > Export)
  • Press Ctrl+Home to clear the current query
  • Open the EFU file (Menu:File > Open File List)
  • Search for
    !dupe:
That should give you the unique files (to test if there are duplicates, search for dupe:)

When done, close the filelist (Menu:File > Close File list)

therube wrote: Mon Oct 28, 2019 3:45 pm You would need a "uniq" command.
If you are on Win10, you can use the (undocumented) /unique switch:

Code: Select all

SORT  /unique lookforuniq.txt  >  lookforuniq2.txt
Post Reply