📜  使用大量内存进行压缩归档 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:20.982000             🧑  作者: Mango

代码示例1
# 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)