[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



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
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
&gt;


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00182" href="msg00182.html">[ale] Looking for duplicate photos</a></strong>
<ul><li><em>From:</em> pras at cycloeastern.com (pras at cycloeastern.com)</li></ul></li>
<li><strong><a name="00186" href="msg00186.html">[ale] Looking for duplicate photos</a></strong>
<ul><li><em>From:</em> trey at fastmail.fm (Trey Sizemore)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00179" href="msg00179.html">[ale] Looking for duplicate photos</a></strong>
<ul><li><em>From:</em> trey at fastmail.fm (Trey Sizemore)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00179.html">[ale] Looking for duplicate photos</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00181.html">[ale] Looking for duplicate photos</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00179.html">[ale] Looking for duplicate photos</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00182.html">[ale] Looking for duplicate photos</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00180"><strong>Date</strong></a></li>
<li><a href="threads.html#00180"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>