# # uniqmail # This file: Copyright (C) 2000 Wolfgang Rohdewald, wr@poboxes.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # This program needs a current version of grepmail which understands # the -u option. set - `ps x | grep kmail | grep -v grep | wc` if test $1 -gt 0 then echo kmail is still running exit 1 fi cd echo Make sure that all folders in kmail are compacted echo and that kmail does not run. #(we might do that here using dcop kmail ... but kmail cannot do that yet) echo echo -n "did you backup $HOME/Mail ? " read answer if test "$answer" != yes then echo "Please answer with yes if you want to continue" exit 3 fi #echo -n making backup to /backup/mail.kmail.$$.tgz ... #tar cfy /backup/mail.kmail.$$.tbz Mail #echo " done" cd Mail (echo ".";find . -name '.*.directory' -print) | while read directory do ls $directory/* 2>/dev/null | while read file do test -s "$file" || continue echo -n $file "... " cat "$file" | grepmail -u > "$file.new" if cmp "$file" "$file.new" >/dev/null then rm "$file.new" echo nothing changed else set -- `diff "$file" "$file.new" | grep '^< Message-Id: ' | wc` echo $1 duplicates removed mv "$file.new" "$file" rm -f `dirname "$file"`/.`basename "$file"`.index fi done done