Compressing file output

Sharing in case this helps others in the future as it took me a little bit to figure out

Powershell can be used to compress an output file:

powershell -command "Add-Type -Assembly 'System.IO.Compression.FileSystem';Add-Type -Assembly 'System.IO.Compression';Remove-Item 'output.zip';[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile([System.IO.Compression.ZipFile]::Open('output.zip','Create'), 'output.txt', 'output.txt')"

See Text Qualifier Assumption Bug as an example of how to wire up a powershell command

1 Like

Great idea! I reworked it a bit – here is a reusable project for zipping a single file. Has two parameters – source file and archive file. Requires Powershell 5.0 or above (pre-installed on Windows 10).

Use Call or Iterate transformations to run it. With Call it’s basically a custom transformation for zipping files.

Can be modified to work with folders, add files to existing archives, etc. Here is the documentation on Compress-Archive command in Powershell.

zip_file.morph (1.7 KB)

1 Like