Advertisement
Guest User

Untitled

a guest
Aug 4th, 2023
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. ## Method 1.
  2. Add-Type -AssemblyName System.IO.Compression.FileSystem;
  3. $source = "D:\Exports\BigFile.dat";
  4. $archive = "C:\Exports\BigFile.zip";
  5. $zipArchive = [System.IO.Compression.ZipFile]::Open($archive, 'Create');
  6. [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipArchive, $source, (Split-Path $source -Leaf));
  7. $zipArchive.Dispose();
  8.  
  9. ## Method 2.
  10. $source = "D:\Exports\BigFile.dat";
  11. $archive = "C:\Exports\BigFile.zip";
  12. Compress-Archive -Path $source -DestinationPath $archive -CompressionLevel Fastest;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement