Bzip2 or gzip format

Hi all,
anyone knows how to create with easymorph an archive file with bzip2 or gzip format?

thank you

You can archive to GZip with PowerShell. Here is a sample project and the script from it:

gzip.morph (1.8 KB)

$File = "{File name}"
$srcFile = Get-Item -Path $File
$newFileName = "$($srcFile.FullName).gz"

    $srcFileStream = New-Object System.IO.FileStream($srcFile.FullName,([IO.FileMode]::Open),([IO.FileAccess]::Read),([IO.FileShare]::Read))
    $dstFileStream = New-Object System.IO.FileStream($newFileName,([IO.FileMode]::Create),([IO.FileAccess]::Write),([IO.FileShare]::None))
    $gzip = New-Object System.IO.Compression.GZipStream($dstFileStream,[System.IO.Compression.CompressionMode]::Compress)
    Write-Host "$_.Exception.Message"

The script is taken here:

Hi Dmitry and thanks,
I was not able to use this script, too many errors, something is probably missing on my server.

Anyway, I solved with 7zip installation and a very simple script:
C:“Program Files”\7-Zip\7z.exe a -tgzip C:\Users\claudio.murano\Desktop\SGtest\prova.gz C:\Users\claudio.murano\Desktop\SGtest\prova.txt
this script call .exe, then we have the command a(=add file), command -t used to define a format + gzip format, finally the archive destination path and the path of file to archive.

Attached the sample project.
gzip_7zip.morph (1.2 KB)

Thank you

1 Like