Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save afwn90cj93201nixr2e1re/4e392c01281f77d2ce5a5861179ca5c5 to your computer and use it in GitHub Desktop.
Save afwn90cj93201nixr2e1re/4e392c01281f77d2ce5a5861179ca5c5 to your computer and use it in GitHub Desktop.
7z list file archivating stdin analog via if then bash
if 7z a -aoa -m0=LZMA2:a=1:d=32m:mf=hc4:fb=273:mc=20000: -mx=9 -myx=10 -mf=on -mhc=on -mhe=on -mmt=4 -mmtf=on -mtm=on -mtc=on -mta=on -ms=on 18-03-2020.7z @file.lst 2>&1 > /dev/null;then
echo "good";
else
echo "bad";
fi;
@afwn90cj93201nixr2e1re
Copy link
Author

7z a -p'1123123' -m0=lzma2 -mx=9 -mfb=64 -md2048m -ms -mhe=on 123.7z @123.lst;
7z a -mx=9 -aoa

-m - Sets compression method
Numbers must begin from 0. Methods that have smaller numbers will be used before others.
0=LZMA2
-ma - Sets compression mode: 0 = fast, 1 = normal. Default value is 1.
-md - Sets Dictionary size for LZMA. You must specify the size in bytes, kilobytes, or megabytes. The maximum value for dictionary size is 1536 MB
-mf - Sets Match Finder for LZMA
-mfb - Sets number of fast bytes for LZMA. It can be in the range from 5 to 273. The default value is 32 for normal mode and 64 for maximum and ultra modes. Usually, a big number gives a little bit better compression ratio and slower compression process.
-mc - Sets number of cycles (passes) for match finder. For example, mf=HC4 and mc=10000 can provide almost the same compression ratio as mf=BT4.
-mlc - Sets the number of literal context bits (high bits of previous literal). It can be in range from 0 to 8. Default value is 3. Sometimes lc=4 gives gain for big files.
-mlp - Sets the number of literal pos bits (low bits of current position for literals). It can be in the range from 0 to 4. The default value is 0.
-mpb - Sets the number of pos bits (low bits of current position). It can be in the range from 0 to 4. The default value is 2. The pb switch is intended for periodical data when the period is equal 2^value (where lp=value).

-mx - level of compression, default 5, set's to 9
-mxy - Sets level of file analysis (9 or more 	analysis of all files (Delta and executable filters))
-mf - compression filters
-mhc - header compression
-mhe - Enables or disables archive header encryption
-mmt - threads num

-ms - solid mode
-stl - Set archive timestamp from the most recently modified file
7z a -r -m0=LZMA2:a=0:d=22:mf=hc4:fb=32:mc=16:lc=3:lp=0:pb=2 outfile.7z infile.dat

7z a -aoa -m0=LZMA2:a=1:d=1536m:mf=hc4:fb=273:mc=20000:lc=0:lp=0:pb=0 -mx=9 -myx=10 -mf=on -mhc=on -mhe=on -mmt=4 -mmtf=on -mtm=on -mtc=on -mta=on -mtr=on -ms=on 123.7z @123.lst;

7z a -aoa -m0=LZMA2:a=1:d=1536m:mf=hc4:fb=273:mc=20000:lc=0:lp=0:pb=0 -mx=9 -myx=10 -mf=on -mhc=on -mhe=on -mmt=4 -mmtf=on -mtm=on -mtc=on -mta=on -mtr=on -ms=on 123.7z @123.lst;

7z a -mx=9 -ms=on -md=31 -mtm=- -mmt -mmtf -md=1536m -mmf=bt3 -mmc=10000 -mpb=0 -mlc=0 archive.7z inputfileordir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment