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.
What do you mean by "I concatenated them into one file, all.gz."?
How did you do that?
.gz and .zip files are two very, very different things. You can't just rename a gz to zip and expect it to work.
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?
gzip and zip are not the same thing. If you are trying to create a .zip, you need to use zip.
It's probably not finding your test001.zip because it's creating a test001.zip.gz.
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:
I used the cat command with >> but that clearly isn't the way to go.
tar(1) - Linux manual page (man7.org)
It is suggested that using tar, you use the -cZf
I don't have zip.