Finding and copying unique files in a directory.

Finding and copying unique files in a directory.

am 07.09.2007 16:34:34 von George Orwell

I have a directory which contains photographs as jpgs. They are a bit mixed up - some sub-directories may contain files also in other sub-directories.

I want to create an archive of these pictures, and, rather than just copy the lot, including duplicates, I'd like to copy only one instance of each.

What is the best way to do this? I've started to think along the lines of:

# find . -print | xargs cksum | sort -u +0 -1

to get a list of filenames - but is there a better way?


Regards,


Il mittente di questo messaggio|The sender address of this
non corrisponde ad un utente |message is not related to a real
reale ma all'indirizzo fittizio|person but to a fake address of an
di un sistema anonimizzatore |anonymous system
Per maggiori informazioni |For more info
https://www.mixmaster.it

Re: Finding and copying unique files in a directory.

am 07.09.2007 18:02:51 von Maxwell Lol

George Orwell writes:

> I want to create an archive of these pictures, and, rather than just copy the lot, including duplicates, I'd like to copy only one instance of each.
>
> What is the best way to do this? I've started to think along the lines of:
>
> # find . -print | xargs cksum | sort -u +0 -1
>
> to get a list of filenames - but is there a better way?

you can pipe it into awk, and only print files with a unique value.
Md5sum (or sha1sum) is better than cksum