"Chris Cable" <[EMAIL PROTECTED]> writes: > Great job to Warly for putting together the perl script. One question > though. What is the easiest way to eliminate duplicate rpms, such as: > > name-1.0.0-2mdk.rpm > name-1.0.0-3mdk.rpm > > which only differ by the Mandrake revision number? This script based on the file date, output the old files of a list, that you can xargs to rm: perl doble /COOL_PATH/RPMS/* | xargs rm or mv `perl doble /COOL_PATH/RPMS*` /YOUP_PATH/old/
#!/usr/bin/perl #--------------------------------------------------------------- # Project : Mandrake # Module : rpm-rebuilder # File : doble # Version : $Id: doble,v 1.4 2000/05/25 03:20:44 flepied Exp $ # Author : Pascal Rigaud # Created On : Thu May 25 15:08:52 2000 #--------------------------------------------------------------- @list = sort @ARGV; foreach (@list) { next unless /\.rpm(\.log)?$/; ($name,$ext) = m|([^/]+)-[^-]+-[^-]+\.([^.]+)\.rpm(\.log)?$|; $name="$name.$ext"; if ($name eq $last) { if ((stat($_))[9] < (stat($lastfile))[9]) { print "$_ "; next; } if ((stat($_))[9] > (stat($lastfile))[9]) { print "$lastfile "; } if ((stat($_))[9] == (stat($lastfile))[9]) { die "__ THIS SHOULDN't HAPP EN __ (2 different rpms with same date) $_\n" } } $last = $name; $lastfile = $_; } print "\n"; # doble ends here
-- Warly