On 18/06/10 11:31, (Ted Harding) wrote:
Possbly useful in locating the duplicates (indeed using 'find') may be:
for i in `find . -type f -print` ; do ls -lgG --block-size=1 $i | awk -v F=$i '{S=$3};{print S " " $5 " " F}' ; done | sort -n
(note the back-quotes around the "find ... ").
Thanks for this (and the detailed explanation).
One thing it fails on is filenames with spaces in them, of which (unfortunately) it seems I have rather a lot....
I can make the "find" handle them using -print0 instead of -print, but I don't see how to make "for" cope with the resulting filelist. However, I assume I can go with something along the lines of:
find . -type f -print0 | xargs -0 -l ls -lgG --block-size=1 "{}" | awk -v F=$i '{S=$3};{print S " " $5 " " F}' | sort -n
.. but that doesn't work as it stands, indeed even this bit: find . -type f -print0 | xargs -0 -l ls -lgG --block-size=1 "{}" .. fails (ls: cannot access "./foo.png"), although I can't see why (ls "./foo.png" works fine).