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

2015-03-04 0 567
简单的批量压缩文件夹下的子文件夹
#!/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 <<<"

遇见资源网 shell 简单的批量压缩文件夹下的子文件夹 http://www.ox520.com/16868.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务