Question
· Mar 26

zip all files in a unix directory in a script to send to windows as email attachment

I have files of mixed types; e.g. a.pdf, b.pdf, c.txt.

I zipped them with gzip to make a.pdf.gz, b.pdf.gz, c.txt.gz.

I concatenated them into one file, all.gz.

I renamed all.gz to all.zip.

I emailed it but cannot extract in windows browser.

Discussion (9)3
Log in or sign up to continue

GZIP format itself does not support files, it's just a compress, usually it can be used with TAR format, which helps to merge multiple files, which can be compressed by GZIP

Look at my project isc-tar, which implements an internal way of creating cross-platform archives without calling external archivers.

https://openexchange.intersystems.com/package/isc-tar

I am trying to avoid using tar.

Let me simplify as I am trying to work with just one file now.

I tried this command;

gzip -9 -r -q test001.zip /path

Where /path is the directory I want to zip all files in and I want to have as output test001.zip, which unix complains that test001.zip does not exist, which I don't understand as I am trying to create this.

Am I misunderstanding the arguments?

If you want to do all files in a directory, including recursively going into all subfolders, the command should be something like:

zip -r test001.zip /path/to/folder/

If you're trying to do this from inside ObjectScript, you'd have to use $ZF -100 to do that:

set args(1) = "-r"
set args(2) = "test001.zip"
set args(3) = "/path/to/folder/"
do $ZF(-100,"","zip",.args)