Create a zip archive from multiple directories

My folder structure is:

folder1
folder2
folder3
zipFolder

How can I create a zip archive that consists of folder1, folder2, folder3 situated in zipFolder?

1

1 Answer

Use zip command recursively as following.

zip -r /path/to/zipFolder/zip_name /path/to/folder{1..3}

Or using tar command.

tar -czf zip_name.tar.gz -C /path/to/zipFolder/ /path/to/folder{1..3}

Note that with -z we are using gzip to compression.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like