The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,779 other followers

Archive for the ‘7zip’ Category

7zip / 7za command-line parameters for highest compression

Posted by jpluimers on 2019/03/14

On my systems these so far give the best compression results with 7zip and p7zip 16.02:

-t7z -m0=lzma2:d=1024m -mx=9 -aoa -mfb=64 -md=32m -ms=on

Note the -d=1024m is mentioned on some sites, but is gone around version 16.

Via:

If you want to delete the files after archiving, then use the -sdel switch: -sdel (Delete files after including to archive) switch

If -sdel switch is specified, 7-Zip deletes files after including to archive. So it works like moving files to archive., moves txt files from disk’s directory to a.7z archive.

–jeroen

Posted in 7zip, Compression, Power User | 1 Comment »

7zip on ESXi through p7zip – redux

Posted by jpluimers on 2019/03/12

Steps to get it working on ESXi 6.x with p7zip 16.02:

  1. Copy the output of https://sourceforge.net/projects/p7zip/files/p7zip/16.02/p7zip_16.02_x86_linux_bin.tar.bz2/download to a place where you can reach it through http (as wget on ESXi does not understand https)
  2. Follow the script below

mkdir -p /local/bin
cd /local bin
wget http://192.168.71.62/esxi/netcologne.dl.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_x86_linux_bin.tar.bz2
bzip2 -d p7zip_16.02_x86_linux_bin.tar.bz2
mv p7zip_16.02/bin/7z* .
chmod 755 7z 7za 7zra

Based on much longer steps involving Windows and an older version of p7zip: 7zip on ESXi through p7zip.

–jeroen

Posted in 7zip, Compression, ESXi4, ESXi6, ESXi6.5, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

Locating the 7z.exe command-line tool on Windows

Posted by jpluimers on 2018/09/18

From one of my scripts: it will find a  64-bit 7z.exe if it was installed as part of the 7-zip installer, then run it with the parameters provided to the batch file.

  setlocal
  
:verify7zip
:: registry trick from http://www.robvanderwoude.com/files/sortdate2_nt.txt
:: extra trick: tokens=2* allows to get the  3rd (and beyond: space delimited!) value in one variable %%b
  for /F "tokens=2*" %%a IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip" /v Path64 2^>nul') do set sevenZipDirectoryPath=%%b
  call :checkMissingSetting sevenZipDirectoryPath     || goto :help
  
  set sevenZipExeFilePath=%sevenZipDirectoryPath%7z.exe
  if not exist "%sevenZipExeFilePath%" call :showError "No 7-zip executable at %sevenZipExeFilePath%" || goto :help
  
:run7zip
  "%sevenZipExeFilePath%" %*

  endlocal
  goto :end
  
:checkMissingSetting
  if not defined %1 call :notifyMissingSetting %1 && exit /b 1
  call :showSetting %1
  exit /b 0
  goto :end

:notifyMissingSetting
  echo Registry didn't provide the environment variable "%1"
  goto :end
  
:showError
  :: remove double quotes using tilde trick:
  echo %~1
  
:help
  echo Syntax: %0 7z.exe-commandline-parameters
  goto :end

:end

–jeroen

Posted in 7zip, Batch-Files, Compression, Development, Power User, Scripting, Software Development | Leave a Comment »

calculate crc32 on the command-line using 7z.exe – Using 7-zip hashing to compare directories and files – Sami Lehtinen

Posted by jpluimers on 2018/02/26

Searching 7z.exe calculate crc32 didn’t return any meaningful results, but [WayBackUsing 7-zip hashing to compare directories and files – Sami Lehtinen did help me as I never noticed that somewhere along the line the h command got added to 7z.exe. It’s not even in the documentation, as found by searching for 7zip commandline arguments:

but it is in the command-line help, at least in versions 16.x:

C:\temp>"C:\Program Files\7-Zip\7z.exe" --help

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21

Usage: 7z  [...]  [...]
       [<@listfiles...>]


  a : Add files to archive
  b : Benchmark
  d : Delete files from archive
  e : Extract files from archive (without using directory names)
  h : Calculate hash values for files
  i : Show information about supported formats
  l : List contents of archive
  rn : Rename files in archive
  t : Test integrity of archive
  u : Update files to archive
  x : eXtract files with full paths

–jeroen

Posted in 7zip, Compression, Power User | Leave a Comment »

Decompression libraries and tools for many formats

Posted by jpluimers on 2016/09/15

7-zip can uncompress a truckload of formats, but what if you need formats it doesn’t support or you want to integrate decompression in your own software?

Then some libraries can be really useful provided you regularly update them (otherwise you – like Symantec – can run in substantial security risks).

libmspack (license: GNU LGPL, version 2)

Formats supported:

File format Year Algorithm Supported?
COMPRESS.EXE (SZDD) 1990 LZSS Decompression
Microsoft Help (.HLP) 1990 LZSS To-do
COMPRESS.EXE (KWAJ) 1993 LZSS, Huffman, DEFLATE Decompression
Microsoft Cabinet (.CAB) 1995 DEFLATE, Quantum, LZX Decompression
HTML Help (.CHM) 1997 LZX Decompression
Microsoft eBook (.LIT) 2000 LZX, SHA, DES To-do
Windows Imaging Format (.WIM) 2007 LZX, XPRESS To-do
Exchange Offline Address Book (.LZX) 2008 LZX DELTA Decompression

cabextract (license: GNU GPL)

Pre-compiled console wrappers around libmspack for many platforms.

WinRAR archiver, a powerful tool to process RAR and ZIP files

Libraries and pre-compiled console applications for many platforms.

HTML Help (CHM) Index

Background on CHM files.

–jeroen

Via:

Symantec dropped the ball here. A quick look at the decomposer library shipped by Symantec showed that they were using code derived from open source libraries like libmspack and unrarsrc, but hadn’t updated them in at least 7 years.

Source: Project Zero: How to Compromise the Enterprise Endpoint

Posted in 7zip, Compression, Development, Power User, Software Development | Leave a Comment »

 
%d bloggers like this: