[geeks] listing identical files

Kevin kevin at mpcf.com
Fri Nov 19 13:14:09 CST 2004


This seems to work fine for my purposes.

Thanks,
/KRM

On Fri, 19 Nov 2004 14:24:22 -0500
Phil Stracchino <alaric at caerllewys.net> wrote:

> On Fri, Nov 19, 2004 at 12:56:15PM -0500, Kevin wrote:
> > Anyone know of a way of listing all the identical files in a
> > directory?
> > 
> > I have a directory containing several large files, many of
> > which are just duplicates with differing names.  I would like
> > to find a way to list all the identical files to help rescue
> > some drive space.
> 
> This is a little involved and messy, but:
> 
> md5sum * 2>/dev/null | sort > foo
> cat foo | cut -d\  -f1 > foo2
> cat foo2 | sort -u > foo3
> for f in `diff foo2 foo3 | cut -d\  -f2`; do grep $f foo; done
> 
> should show you all duplicates.  It's up to you to determine
> from there which are hardlinks, which are symlinks, and which
> are duplicates.
> 
> 
> 
> 
> -- 
>   ========== Fight Back!  It may not be just YOUR life at risk.
>   ========== alaric at caerllewys.net :
>   phil-stracchino at earthlink.net : phil at novylen.net
>    phil stracchino : unix ronin : renaissance man : mystic zen
>    biker geek
>      2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986
>      VF500F (sold)
>            Linux Now!  ...Friends don't let friends use
>            Microsoft.
> _______________________________________________
> GEEKS:  http://www.sunhelp.org/mailman/listinfo/geeks


-- 
"Make it idiot proof and someone will make a better idiot."
keyserver: http://pgp.mit.edu/



More information about the geeks mailing list