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.
Show exactly one copy of each filename?
Re: Show exactly one copy of each filename?
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).
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.
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.
Re: Show exactly one copy of each filename?
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
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...
Re: Show exactly one copy of each filename?
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:
When done, close the filelist (Menu:File > Close File list)
If you are on Win10, you can use the (undocumented) /unique switch:
Code: Select all
SORT /unique lookforuniq.txt > lookforuniq2.txt