安裝暫且不說了。
看一下幫助。
[root@localhost Server]# 7z 7-Zip [64] 9.13 beta Copyright (c) 1999-2010 Igor Pavlov 2010-04-15 p7zip Version 9.13 (locale=zh_CN.UTF-8,Utf16=on,HugeFiles=on,2 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[-|0]]{@listfile|!wildcard}: Include archives -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives -bd: Disable percentage indicator -i[r[-|0]]{@listfile|!wildcard}: Include filenames -m{Parameters}: set compression Method -o{Directory}: set Output directory -p{Password}: set Password -r[-|0]: Recurse subdirectories -scs{UTF-8 | 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[-|0]]]{@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了