#!/bin/sh # Ensure that every message in an nnml mail tree is compressed. # # With no argument, use ~/mail as the root. Otherwise, use the # argument provided as the root. # # Even though I set `nnml-use-compressed-files' in .gnus, (and even # `auto-compression-mode' in .emacs), Gnus still doesn't always seem # to compress every file. Sometimes I run this to make sure # absolutely everything is compressed. Obviously, don't run this # while Gnus is running (it might be nice for Gnus to give some sort # of external indication that it is running, that this script could # look for). if [ "${1}" != "" ]; then ROOT="${1}" else ROOT="${HOME}/mail" fi for name in `find "${ROOT}" -type f -regextype egrep -regex "(.*-outwent$|.*/[0-9]+$)" -print`; do if [ -f "${name}.gz" ]; then gunzip -c "${name}.gz" > /tmp/tmp-unzipped-$$ if cmp "${name}" /tmp/tmp-unzipped-$$; then rm "${name}" echo "FOLDED: '${name}' was redundant with '${name}.gz'" >&2 else echo "ERROR: '${name}' and '${name}.gz' are different" >&2 fi rm /tmp/tmp-unzipped-$$ else gzip --best "${name}" echo "COMPRESSED: '${name}' ==> '${name}.gz'" fi done