安装暂且不说了。

看一下帮助。

[root@localhost Server]# 7z

-Zip [] 9.13 beta  Copyright (c) - Igor Pavlov  --
p7zip Version 9.13 (locale=zh_CN.UTF-,Utf16=on,HugeFiles=on, CPUs) Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>] <Commands>
a: Add files to archive
b: Benchmark
d: Delete files from archive
e: Extract files from archive (without using directory names)
l: List contents of archive
t: Test integrity of archive
u: Update files to archive
x: eXtract files with full paths
<Switches>
-ai[r[-|]]{@listfile|!wildcard}: Include archives
-ax[r[-|]]{@listfile|!wildcard}: eXclude archives
-bd: Disable percentage indicator
-i[r[-|]]{@listfile|!wildcard}: Include filenames
-m{Parameters}: set compression Method
-o{Directory}: set Output directory
-p{Password}: set Password
-r[-|]: Recurse subdirectories
-scs{UTF- | WIN | DOS}: set charset for list files
-sfx[{name}]: Create SFX archive
-si[{name}]: read data from stdin
-slt: show technical information for l (List) command
-so: write data to stdout
-ssc[-]: set sensitive case mode
-t{Type}: Set type of archive
-u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
-v{Size}[b|k|m|g]: Create volumes
-w[{path}]: assign Work directory. Empty path means a temporary directory
-x[r[-|]]]{@listfile|!wildcard}: eXclude filenames
-y: assume Yes on all queries

记得最苦恼的就是一个排除目录的压缩,后面才明白,由于Linux !有特别的意义,所以要用转义符来使用。

7z a -t7z tmp.7z curdir -xr\!excludedir

后面一直没弄明白如果我要排除某一类型的文件呢?这又怎么整呢。事实上是需要用到通配符,所以要用以下的命令才对。

对递归的说明如下:

-r 递归子目录选项。
-r 开启递归子目录。对于 e (释放)、l (列表)、t (测试)、x (完整路径释放) 这些在压缩档案中操作的命令, 会默认使用此选项。
-r- 关闭递归子目录。对于 a (添加)、d (删除)、u (更新) 等所有需扫描磁盘文件的命令,会默认使用此选项。
-r0 开启递归子目录。但只应用于通配符。

默认情况下,adu等是关闭了递归扫描所以需要开启进行排除。

7z a -t7z tmp.7z curdir -xr0\!*.log

如此,便OK了

最新文章

  1. 在sharepoint2013中如使用PowerView
  2. 【BZOJ 4561】【JLOI 2016】圆的异或并
  3. 课堂Beta发布140字评论
  4. Oracle VM VirtualBox配置文件
  5. 使用ExifInterface设置Datetime发生的问题
  6. Windows,linux快捷键
  7. TYVJ P1074 武士风度的牛 Label:跳马问题
  8. jqGrid API 相关
  9. windows server 2008 r2电脑历史操作记录
  10. JS 版的pnp in_array($str,$arr)
  11. Java中的IO学习总结
  12. PHP关联数组和哈希表(hash table) 未指定
  13. shell中的cat和文件分界符(&lt;&lt;EOF)
  14. dedecms文章页调用上一篇和下一篇文章
  15. 利用可变参实现fprintf函数
  16. golang初识2
  17. java使用Iterator 迭代器
  18. 【Codeforces 1110E】Magic Stones
  19. Hdu-1358Period(KMP算法之next数组的应用)
  20. timestamp 字段

热门文章

  1. HBase High Level Architecutre
  2. iOS程序的启动过程-UIWindow
  3. 读者写者问题(有bug 后续更改)
  4. 测试bug级别定义
  5. 调整label中text显示的行间距
  6. 分享Windows Server 2012 R2的获取正版密钥方法
  7. HibernateDaoSupport 源码
  8. nginx添加未编译安装模块
  9. yii2 ArrayHelper map 使用
  10. BZOJ 2331 地板