美文网首页
批量压缩子文件夹

批量压缩子文件夹

作者: 一只特例独行de猪 | 来源:发表于2019-07-13 16:13 被阅读0次
    #!/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 <<<"
    

    相关文章

      网友评论

          本文标题:批量压缩子文件夹

          本文链接:https://www.haomeiwen.com/subject/otrmkctx.html