2011-02-23 15:39:35 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
help() {
|
|
|
|
cat <<EOF
|
2012-07-11 11:21:12 +02:00
|
|
|
Usage: `basename "$0"` -h | [-n] [-g|-b|-l|-x|-c PACKER] DIR [DIR [...]]
|
2011-02-23 15:39:35 +01:00
|
|
|
Komprimiert alle Dateien in DIR/archive.
|
|
|
|
-n Trockenlauf
|
2012-07-11 11:21:12 +02:00
|
|
|
Packer: -g: gzip, -b: bzip2, -l: lzma, -x: xz, -c PACKER: einen anderen.
|
2011-02-23 15:39:35 +01:00
|
|
|
EOF
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
p=gzip
|
|
|
|
|
2012-07-18 16:29:29 +02:00
|
|
|
while getopts he:ngblxc: o
|
2011-02-23 15:39:35 +01:00
|
|
|
do
|
|
|
|
case "$o" in
|
|
|
|
--) break ;;
|
|
|
|
-h) help ;;
|
|
|
|
-n) n=echo ;;
|
|
|
|
-g) p=gzip ;;
|
|
|
|
-b) p=bzip2 ;;
|
|
|
|
-l) p=lzma ;;
|
2012-07-11 11:21:12 +02:00
|
|
|
-x) p=xz ;;
|
2012-07-18 16:29:29 +02:00
|
|
|
-c) p="$OPTARG" ;;
|
2011-02-23 15:39:35 +01:00
|
|
|
esac
|
|
|
|
done
|
2012-07-30 11:46:57 +02:00
|
|
|
shift `expr $OPTIND - 1`
|
2011-02-23 15:39:35 +01:00
|
|
|
|
|
|
|
[ 0 -lt $# ] || help
|
|
|
|
|
|
|
|
for d
|
|
|
|
do
|
2012-07-11 13:33:11 +02:00
|
|
|
find "$d" -name archive -type d -exec sh -c 'empty=
|
|
|
|
find "$1" -type f ! -name "*.bz2" ! -name "*.gz" ! -name "*.lzma" ! -name "*.xz" -exec '"$n"' '"$p"' -- "{$empty}" \;' -- '{}' \;
|
2011-02-23 15:39:35 +01:00
|
|
|
done
|