7z
mac install
brew install p7zip
example
7z a -r -mx9 a:\\b\\c
最终在b目录下生成c.7z
7z a -tzip archive.zip -r src\*.cpp src\*.h
7z x a:/b/c.zip -od:/e/dest
最终将c.zip中的内容解压到dest目录, 没有c目录
7z x archive.zip -od:\dest
7z x archive.zip -od:\soft *.cpp -r
7z x test.zip -aoa
-aoa Overwrite All existing files without prompt.
7z a archive.zip *.jpg -mx0
adds *.jpg files to archive.zip archive without compression.
7z a archive.7z *.exe *.dll -m0=BCJ -m1=LZMA:d=21
adds *.exe and *.dll files to solid archive archive.7z using LZMA method with 2 MB dictionary and BCJ filter.
7z a archive.7z a.tar -mf=BCJ2 -mx
adds a.tar files to archive archive.7z using BCJ2 filter.
7z a archive.7z *.wav -mf=Delta:4
adds *.wav files to archive archive.7z using Delta:4 filter.
7z a a.7z *.exe *.dll -m0=BCJ2 -m1=LZMA:d25 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3
adds *.exe and *.dll files to archive a.7z using BCJ2 filter, LZMA with 32 MB dictionary for main output stream (s0), and LZMA with 512 KB dictionary for s1 and s2 output streams of BCJ2.
7z a archive.7z *.txt -m0=PPMd
adds *.txt files to archive archive.7z using PPMd method.
7z a a.tar.xz a.tar -mf=bcj -mx
adds a.tar files to archive a.tar.xz using BCJ filter.
compress
将当前目录下的 01
目录, 压缩为 log01.7z
, 压缩质量最高-mx=9
7z a log01.7z 01 -t7z -mx=9
绝对路径
7z a /a/b/c/log/test/logTest.7z /a/b/c/log/01 -t7z -mx=9
decompress
解压log01.7z
到当前目录下的Abc目录, 最终结果没有log01
目录
7z x log01.7z -o./Abc
7z x log01.7z -aoa -o./xyz
-aoa Overwrite All existing files without prompt.
-aos Skip extracting of existing files.
-aou aUto rename extracting file (for example, name.txt will be renamed to name_1.txt).
-aot auto rename existing file (for example, name.txt will be renamed to name_1.txt)
encrypt
7z a archive.7z -psecret -mhe *.txt
compresses *.txt
files to archive.7z
using password secret
.
Also it encrypts archive headers (-mhe
switch), so filenames will be encrypted.
7z x archive.zip -psecret
extracts all files from archive.zip using password secret
.