Reputation: 33648
I have two zip archives. Say, set1
has 10 csv files created using Mac OS X 10.5.8 compress
option, and set2
has 4 csv files similarly created. I want to take the 4 files from zipped archive set2
and add them to list of files in archive set1
. Is there a way I can do that?
I tried the following in Terminal:
zip set1.zip set2.zip
This adds the whole archive set2.zip
to set1.zip
, i.e., in set1.zip
now I have:
file1.csv, file2.csv,..., file10.csv, set2.zip
What I instead want is:
file1.csv, file2.csv,..., file10.csv, file11.csv, ..., file14.csv
where, set2.zip
is the archive containing file11.csv, ..., file14.csv
.
Thanks.
Upvotes: 0
Views: 2051
Reputation: 39935
unzip set2.zip -d .tmpdir; cd .tmpdir; zip ../set1.zip *; cd ..; rm -r .tmpdir;
Upvotes: 1
Reputation: 101
This script here should do it.
zipjoin.sh
#!/bin/bash
#Example: ./zipjoin.sh merge_into.zip merge_from.zip
mkdir .tmp
unzip $2 -d .tmp
zip $1 .tmp/*
rm -r .tmp
Hope that helps!
Upvotes: 0
Reputation: 36534
I don't know of a built-in OS X tool, but there's a zipmerge utility as part of the libzip package (hg repository available).
Upvotes: 1