Quoting Bob Tanner (tanner at real-time.com): > Bob asks: > > > Anyone know of a tool that will "prune" old rpms from a directory? What I'm > > referring to is something that will cruise through the /usr/src/redhat/RPMS > > and /usr/src/redhat/SRPMS and remove all but the newest files. > > Clay responds: > > Perl is your friend. > > (NOTE: This is just an example I whipped up in a few minutes. I will not be > responsible for any data loss) Here is another script I found on the 'net, it doesn't work either :-) #!/usr/bin/perl # # # remove the old rpms in the current directory # opendir(DIR,'.'); @package=grep(/\.rpm$/,readdir(DIR)); foreach $file (@package) { $file =~ /(.*)\-([\d+|\.]+\w*)\-(\d+)\.[i386|noarch].*/; $nom=$1; $version=$2; $buildvers=$3; if ($NOM{$nom}) { $version2=$VERSION{$nom}; $buildver2=$BUILDVERS{$nom}; $file2=$FILE{$nom}; $nom2=$NOM{$nom}; if ($version2 gt $version) { print "$file2 is newer than $file\n"; unlink($file); } else { if ($version2 lt $version) { print "$file is newer than $file2\n"; unlink($file2); $VERSION{$nom}=$version; $BUILDVERS{$nom}=$buildvers; $FILE{$nom}=$file; $NOM{$nom}=$nom; } else { if ($buildver2 > $buildvers) { print "$file2 : $buildver2 is newer then $file : $buildvers\n"; unlink($file); } else { print "$file2 : $buildver2 is older than $file : $buildvers\n"; unlink($file2); $VERSION{$nom}=$version; $BUILDVERS{$nom}=$buildvers; $FILE{$nom}=$file; $NOM{$nom}=$nom; } } } } else { $VERSION{$nom}=$version; $BUILDVERS{$nom}=$buildvers; $FILE{$nom}=$file; $NOM{$nom}=$nom; } } -- Minneapolis St. Paul Twin Cities MN | Phone : (952)943-8700 http://www.mn-linux.org Minnesota Linux | Fax : (952)943-8500 Key fingerprint = 6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9