mirror of
https://github.com/mfocko/blog.git
synced 2024-11-25 06:11:55 +01:00
26 lines
639 B
Bash
26 lines
639 B
Bash
#!/bin/sh
|
|
|
|
# remove preexisting archives
|
|
echo "[INFO] Removing pre-existing archives"
|
|
find ./static/files -name '*.tar.gz' -exec rm {} \;
|
|
find ./static/files -name '*.tar.bz2' -exec rm {} \;
|
|
|
|
ROOT_DIR=$PWD
|
|
|
|
for relative_path in $(find ./static/files -name '.archive' -print); do
|
|
echo;
|
|
|
|
relative_path=$(dirname $relative_path)
|
|
base=$(basename $relative_path)
|
|
cd $relative_path/..
|
|
|
|
all_files=$(find $base/** ! -name '.archive' -print)
|
|
|
|
echo "[INFO] Compressing $base.tar.gz"
|
|
tar caf $base.tar.gz $all_files
|
|
|
|
echo "[INFO] Compressing $base.tar.bz2"
|
|
tar caf $base.tar.bz2 $all_files
|
|
|
|
cd $ROOT_DIR
|
|
done;
|