Fast {en|de}cryption with 7z


I was in need of a flexible encryption solution for a large amount of files. After trying VHD with Veracrypt which was not fast and flexible enough for my use case. I resorted to 7z with no compression. Your files are encrypted and protected

7z.exe a -p -mx=0 -mhe -t7z -sdel -v4000M .\<dir_of_your_7z_dir>\>your_archive.7z> .\<yourfilelocation>

The other day i had the need to do encrypt entire listing of directories. I ended up with this powershell script

$7zipcmd = "7z.exe a -p -mx=0 -mhe -t7z -v4000M"

$dirs = Get-ChildItem -directory .

foreach ($dir in $dirs) 
  $arcName = $dir.Name + '.7z'
  $arcTarget = $dir.FullName
  $TotalCMD = $7zipcmd + " " + '"'  + $arcName + '"' + " " + '"' + $arcTarget + '"'
  Invoke-Expression $TotalCMD

Ofcourse this can be done by the mouse as well but i recommend doing this in a shell on your OS. 7zip is multi-platform so this commands work so expect these commands to render the same results.

Back to top