Answers for "compress-archive using lot of memory"

0

compress-archive using lot of memory

# File or directory to zip
$sourcePath = "C:\Path\To\File"
# Resulting .zip file
$destinationPath = "C:\Path\To\File.zip"
# Compression level. Optimal means smallest size, even if it takes a little longer to compress
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
# Whether or not to include root directory (if zipping a directory) in the archive
$includeBaseDirectory = $false
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory("$sourcePath","$destinationPath",$compressionLevel,$includeBaseDirectory)
Posted by: Guest on October-17-2020

Browse Popular Code Answers by Language