I am trying to compress the hundreds of jar files into a single zip file that can be transferred to a different location. Please help.


Jar files are very similar to zip archives therefore combining them into one archive will not save a lot of space. However if you really want to make one zip archive then one of the simplest solution would be to execute for loop on all jar files:

for f in *.jar; do
 zip archive.zip "$f"

If you want to use gzip, then:

tar -czvf archive.tar.gz *.jar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.