简单的批量压缩文件夹下的子文件夹

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/bin/sh
# Refer: http://hw1287789687.iteye.com/blog/1766217
# Author: aWang
# Date: 2014-1-14 13:00:18
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 <<<"