linux命令学习:压缩-分卷-跳过文件

linux工具  ·  2020-11-10


tar命令

1.跳过文件(夹)

tar jcv -f union_TX08.tar.bz2 --exclude=*/.svn union_TX
tar jcv -f union_TX08.tar.bz2 --exclude=/.svn/ union_TX

--exclude 不能放到 -f 和 union 之间
svn/ 和svn 是不同的
2.tar分卷
tar jcf - sites50.hk/ | split -b 1024m - www.sites50.hk.tar.bz2 &
cat www.sites50.hk.tar.bz2.a* | tar xj

zip命令

1.zip跳过目录

zip -rv app.zip app/ -x "/.svn/" #递归跳过.svn目录

2.覆写(同步)

zip -FSr foo.zip foo #压缩时,若已存在zipfile,可以实现覆写

  • zip 3.0 +
  • add any new files in the folder to the zip,
  • and delete any files from the zip that aren't in the folder.
3.压缩强度:
zipinfo -t a.zip   // 查看zip文件的压缩比  
        -m a.zip   // 显示每个文件的压缩比    
 
评论
Glab. All Rights Reserved. Theme Jasmine by Kent Liao.