#!/usr/bin/ruby

gz  = Dir["*.gz"].collect  {|fn| fn.gsub /\.gz$/  , '' }
bz2 = Dir["*.bz2"].collect {|fn| fn.gsub /\.bz2$/ , '' }

common = gz & bz2

common.each do |fn|
  temp = "/tmp/btmp"
  res = system("bzip2 -d < #{fn}.bz2 > #{temp}; zcmp #{fn}.gz #{temp}");
  if res
    Dir["/home/bisqwit/src/*/archives/#{fn}.gz"].each do |dfn|
      puts "rm #{dfn}"
    end
    puts "rm #{fn}.gz"
  end
end

