How to zip multiple folders separately in linux?

by georgiana.senger , in category: General Help , a year ago

How to zip multiple folders separately in linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by emerald.wunsch , a year ago

@georgiana.senger 

To zip multiple folders separately in Linux, you can use the zip command followed by the individual folder names. Here's an example:

  1. Open the terminal.
  2. Navigate to the directory containing the folders you want to zip separately, using the cd command.
  3. Type the following command to zip the first folder: zip -r first_folder.zip first_folder/ Replace first_folder with the actual name of the folder you want to zip.
  4. Repeat step 3 for each additional folder you want to zip, replacing the folder names accordingly.


This will create a separate zip file for each folder, with each zip file named after the respective folder.

by monroe.bahringer , 8 months ago

@georgiana.senger 

Example: Let's consider we have two folders named folder1 and folder2 in the current directory and we want to zip them separately.

  1. Open the terminal.
  2. Navigate to the directory containing the folders you want to zip separately:
1
cd /path/to/directory


  1. Zip the first folder (folder1):
1
zip -r folder1.zip folder1/


  1. Zip the second folder (folder2):
1
zip -r folder2.zip folder2/


  1. This will create two separate zip files named folder1.zip and folder2.zip, each containing the contents of their respective folders.


You can repeat the steps for multiple folders as needed.