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

Re: Script to delete duplicate files



On Sat, May 20, 2006 at 09:18:32AM -0600, Paul E Condon wrote:
> On Fri, May 19, 2006 at 08:40:33PM -0700, Curtis Vaughan wrote:
> > Paul E Condon wrote:
> > 
> > >On Fri, May 19, 2006 at 07:10:41PM -0700, Curtis Vaughan wrote:
> > > 
> > >
> > >>Ok, using fdupes -f I have created a file that contains a list of all 
> > >>duplicate files. So, what command can a run against that file to delete 
> > >>all the files listed in it?
> > >>
> > >>Or since I know that fdupes -f works, could I just do something like:
> > >>
> > >>fdupes -f ./ | rm *
> > >>
> > >>or would that rm everything?
> > >>
> > >>   
> > >>
> > >
> > >read 
> > >man fdupes
> > >note the -d option
> > >
> > >
> > > 
> > >
> > No actually the -d option is not an option. The reason is is because it 
> > then asks you after all found duplicates, which of them you wish to 
> > keep. Well, I have some 5000 duplicates to go through, so it will take 
> > forever. I would rather think of a way to use the output of fdupes or 
> > the file I created to delete all the duplicates.
> 
> Do you have 5000 duplicates of a single file or 5000 duplicate groups,
> i.e. groups of files that are mutually identical? Do you really want to
> delete ALL copies of a file for which there are duplicates? I suspect not,
> but I really don't know. If you want to keep one representative copy of
> each duplicate group (what I suspect you should want), you have to provide
> some method of deciding which one of the several copies that fdupes has
> found. There is, I think, more to your problem than you realize. But,
> I really don't know.

I think you'll probably have to loop through a listing, building a
list of "originals" (that is, the first occurrence of a particular
file) and then deleting anything that matches what you have already
found.

A

Attachment: signature.asc
Description: Digital signature


Reply to: