批量压缩子文件夹
2019-07-13 本文已影响0人
一只特例独行de猪
#!/bin/sh
# Refer: http://ethanzhu.leanote.com/post/%E6%89%B9%E9%87%8F%E5%8E%8B%E7%BC%A9%E5%AD%90
# Author: EthanZhu
gzip_alldir(){
# 这里不是'ls -a $1',而是`ls -a $1`
for file in `ls -A $1`
do
if [ -d "$1/$file" ];then
echo $file
tar -cvf $file."tar" $file
gzip -vf $file."tar"
# list_alldir "$1/$file"
fi
done
}
echo ">>> Start >>>"
gzip_alldir $1
echo "<<< Finish <<<"