[ale] Looking for duplicate photos

aaron aaron at pd.org
Sun Feb 6 12:49:19 EST 2005


Here's one that I think covers all the suggestions. It also adds handling for 
odd filename characters and  generates a "remove" script that can be checked 
before deleting files:

http://elonen.iki.fi/code/misc-notes/remove-duplicate-files/

On Sunday 06 February 2005 12:37, pras at cycloeastern.com wrote:
> Only couple of enhancements I would make is 
> 
> make ls --sort...
> to ls -ltr --sort as he said the pics might be nested in a directory.
> 
> Also
> 
> I would do 'chksum' and match that as well before the rm..
> 
> Just my 2 cents
> -Prasanna Subash
> 
> 
> On Sun, Feb 06, 2005 at 11:51:23AM -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
> > 
> > On Sun, 06 Feb 2005 11:19:42 -0500, Trey Sizemore <trey at fastmail.fm> 
wrote:
> > > I've got a number of photos from my digital camera stored on my machine
> > > and a number of them are duplicates.  I was wondering if there was a
> > > script that would identify the duplicates and their locations so I can
> > > purge them to better organize and post.  There is a /photos directory
> > > that itself contains both photos and other sub-directories so it would
> > > need to search both the /photos directory and all sub-directories within
> > > it.
> > > 
> > > Am I wishfully thinking?  I don't have experience with sed and awk
> > > (although I've used grep and pipes in the past) but this is beyond my
> > > limited understanding.
> > > 
> > > Thanks.
> > > 
> > > --
> > > Cheers,
> > > Trey
> > > ---
> > > 
> > > "Men do not differ much about what things they will call evils;
> > > they differ enormously about what evils they will call excusable."
> > > -- GK Chesterton
> > > 
> > > 11:15AM up 3:03, 0 users, load averages: 0.39, 0.43, 0.61
> > > FreeBSD salamander.thesizemores.net 5.3-STABLE i386
> > > 
> > > _______________________________________________
> > > Ale mailing list
> > > Ale at ale.org
> > > http://www.ale.org/mailman/listinfo/ale
> > >
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://www.ale.org/mailman/listinfo/ale
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
> 



More information about the Ale mailing list