[ale] Looking for duplicate photos
Trey Sizemore
trey at fastmail.fm
Sun Feb 6 14:45:10 EST 2005
On Sun, 2005-02-06 at 11:51 -0500, Jim Patterson wrote:
> Trey,
>
> The following script is primitive, but I think it should work fine for you.
> If you name if del_dup.sh, then run it with:
> ./del_dup.sh /photos /photos/* /photos/*/*
>
> It does not recurse automagicaly, but you can extend it with too much
> work. Just take the top level directory and use find to locate all the
> sub-directories. Then pass that list to ls. NOTE: you can not use
> ls -R since that breaks each directory into seperate sections.
>
> Jim P.
>
> #! /bin/sh
>
> oldsize="-"
> oldfile="-"
>
> for f in `ls --sort=size $*`
> do
> dl=`ls -l "$f" | tr -s " "`
> size=`echo $dl | cut -f 5 -d " "`
> file=`echo $dl | cut -f 9 -d " "`
>
> if [ "$oldsize" = "$size" ]
> then
> if diff -q "$oldfile" "$file" >/dev/null
> then
> echo Deleting $file dup of $oldfile
> rm "$file"
> fi
> else
> oldsize=$size
> oldfile=$file
> fi
> done
Thanks, I've been a bit hesitant to try it because it looks like it will
delete one of the files without prompting for which one. Is this
correct? When duplicates are found, I'd want the option for saying
which of the 2 files I want removed.
Is that possible? The script Aaron posted a link to is supposed to do
that, but per a post later in the thread, I'm having some issues getting
it to run.
Thanks.
--
Cheers,
Trey
---
No lake so still but that it has its wave;
No circle so perfect but that it has a blur.
I would change things for you if I could;
As I can't, you must take them as they are.
-Han fei Tzu
2:37PM up 6:25, 0 users, load averages: 0.26, 0.77, 0.69
FreeBSD salamander.thesizemores.net 5.3-STABLE i386
More information about the Ale
mailing list