55

How can I create a multipart 7zip file in Linux using the p7zip console client?

Many people referred me to it. My console app is

7-Zip [64] 9.13 beta  Copyright (c) 1999-2010 Igor Pavlov  2010-04-15
p7zip Version 9.13 (locale=C,Utf16=off,HugeFiles=on,4 CPUs)
wonea
  • 1,817
  • 1
  • 23
  • 42
hopeseekr
  • 1,622
  • 5
  • 17
  • 24
  • 1
    IMO the best solution is to avoid 7-zip and use xz. To split archives, read here: http://stackoverflow.com/questions/1120095/split-files-using-tar-gz-zip-or-bzip2 – Marco Sulla Sep 27 '14 at 11:05
  • Thank you. I'm not even for sure the xz option was even standard on most distros when I originally asked this question. – hopeseekr Dec 07 '14 at 00:09

1 Answers1

89

Use the -v option (v is for volume) -v100m will split the archive into chunks of 100MB.

7z -v option supports b k m g (bytes, kilobytes, megabytes, gigabytes)

Example: 7z -v100m a my_zip.7z my_folder/

Kristian
  • 290
  • 1
  • 3
  • 15
Nifle
  • 34,203
  • 26
  • 108
  • 137
  • 4
    Be aware that 7zip doesn't preserve file ownership information on Linux. – Dennis Williamson Sep 04 '10 at 15:10
  • 7z seem not to append files if file are already in the archive or if archive already exists. – MUY Belgium Jun 08 '16 at 14:13
  • 2
    Also works on OSX using `brew install p7zip`. – phoenix Oct 27 '16 at 14:58
  • 30
    Full command example: `7z -v100m a my_zip.7z my_folder/` – phoenix Nov 11 '16 at 18:33
  • @DennisWilliamson, thx, we can tar b4 7z then naming archive.tar.7z ! file-roller accepted opening archive.tar.7z.001 file properly and I confirmed the permissions and ownership with `tar -tvf` on the extracted tar file :) – Aquarius Power Apr 01 '22 at 21:28
  • 1
    The example command creates 100m volumes named `my_zip.7z.001`, `my_zip.7z.002`, etc. To extract from these volumes, use this command: `7z e my_zip.7z.001`. Even though you are specifying only the the first part in the command, the command will look for all the parts in the same folder and extract it. – djruss70 Feb 16 '23 at 01:08