7Z - build new zip - <Solved>

Technical issues/questions of an intermediate or advanced nature.
User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

7Z - build new zip - <Solved>

Post#1 by Ed_P » 08 Nov 2022, 19:08

How does one open 7Z to build a new zip file? 7Z works great for opening existing zip files and extracting a file or adding files to it but I'm trying to create a new one. :hmmm:
Ed

donald
Full of knowledge
Full of knowledge
Posts: 2064
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

7Z

Post#2 by donald » 08 Nov 2022, 21:13

gui or cli ?
gui > navigate to folder/file(s) to archive, select them and click the add button.

cli example:

Code: Select all

guest@porteus:~/The ultimate goth collection$ 7z a goth.7z ./*.mp4

Scanning the drive:
7 files, 29243861 bytes (28 MiB)

Creating archive: goth.7z

Items to compress: 7

                                                      
Files read from disk: 7
Archive size: 29007383 bytes (28 MiB)
Everything is Ok
guest@porteus:~/The ultimate goth collection$ 

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

7Z

Post#3 by Ed_P » 08 Nov 2022, 23:18

donald wrote:
08 Nov 2022, 21:13
gui or cli ?
cli is fine to invoke the app and gui is preferred to select the files to be added to it. I don't want to compress a whole folder just a file or two from 1 and a file or two from a different one.

I created a file with zip on the end hoping it would open 7z and allow me to add files to it but 7z balked trying to open it.
Ed

donald
Full of knowledge
Full of knowledge
Posts: 2064
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

7Z

Post#4 by donald » 09 Nov 2022, 01:18

I do not use the p7zip gui because most of the (menu) options do not work.
However, one can add files to an existing archive.(created with p7zip)

open the archive > navigate to the files you want to be added > select them and click 'add' >
At the top of the next window choose your zip archive > files are added.
this works as long as you haven't moved the archive to a different location.

if you did move the archive and want to add files:
open the archive > navigate to the files you want to add > select them > add --
BUT
in the next window click the [...] browse button > find your archive > select it,
click save > a pop-up 'this file does exist - overwriting?' > yes > back to
the previous window > OK -- new files added old ones still there.

btw.
this tool creates a lot of 7zCompress-xx-xx.tmp files and doesn't clean-up.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

7Z

Post#5 by Ed_P » 09 Nov 2022, 03:03

donald wrote:
09 Nov 2022, 01:18
However, one can add files to an existing archive.(created with p7zip)
I'm beginning to think that is the solution. Create a dummy zip file and then use it to create other new ones by deleting the dummy file. :hmmm:
Ed

donald
Full of knowledge
Full of knowledge
Posts: 2064
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

7Z

Post#6 by donald » 09 Nov 2022, 04:31

dummy file ?? ..why?
If you open the gui, navigate to files you want in an archive, select them,
click the 'add' button, in the next window select options/name, click OK and
a new archive is created.
(by default in the same folder where the selected files are.The p7zip gui does not
refresh to show it.You have to go (e.g) one folder up and back again to see
the new archive in the gui)
And as I said, you can add/delete files to/from this archive later if you want.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

7Z

Post#7 by Ed_P » 09 Nov 2022, 06:02

There is no p7zip gui option in my menu. :Search:

Added in 46 minutes 59 seconds:
Archive Manager!!! That's what zips files! :shock: Okay. Good to find that out. :happy62:
Ed

donald
Full of knowledge
Full of knowledge
Posts: 2064
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

7Z

Post#8 by donald » 09 Nov 2022, 06:55

ooops....my bad....the P7ZIP File Manager has been stripped out. :oops:
but the example for cli usage should be valid.
and 7z -h for more options.

--> Archive Manager!!! That's what zips files! Okay. Good to find that out.<--
Yup, I was wondering why you didn't use it in the first place. :)

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

7Z

Post#9 by Ed_P » 09 Nov 2022, 07:04

7z -h shows a lot of options:

Code: Select all

guest@porteus:~$ 7z -h

7-Zip [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]

<Commands>
  a : Add files to archive
  b : Benchmark
  d : Delete files from archive
  e : Extract files from archive (without using directory names)
  h : Calculate hash values for files
  i : Show information about supported formats
  l : List contents of archive
  rn : Rename files in archive
  t : Test integrity of archive
  u : Update files to archive
  x : eXtract files with full paths

<Switches>
  -- : Stop switches parsing
  @listfile : set path to listfile that contains file names
  -ai[r[-|0]]{@listfile|!wildcard} : Include archives
  -ax[r[-|0]]{@listfile|!wildcard} : eXclude archives
  -ao{a|s|t|u} : set Overwrite mode
  -an : disable archive_name field
  -bb[0-3] : set output log level
  -bd : disable progress indicator
  -bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
  -bt : show execution time statistics
  -i[r[-|0]]{@listfile|!wildcard} : Include filenames
  -m{Parameters} : set compression Method
    -mmt[N] : set number of CPU threads
    -mx[N] : set compression level: -mx1 (fastest) ... -mx9 (ultra)
  -o{Directory} : set Output directory
  -p{Password} : set Password
  -r[-|0] : Recurse subdirectories
  -sa{a|e|s} : set Archive name mode
  -scc{UTF-8|WIN|DOS} : set charset for for console input/output
  -scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files
  -scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands
  -sdel : delete files after compression
  -seml[.] : send archive by email
  -sfx[{name}] : Create SFX archive
  -si[{name}] : read data from stdin
  -slp : set Large Pages mode
  -slt : show technical information for l (List) command
  -snh : store hard links as links
  -snl : store symbolic links as links
  -sni : store NT security information
  -sns[-] : store NTFS alternate streams
  -so : write data to stdout
  -spd : disable wildcard matching for file names
  -spe : eliminate duplication of root folder for extract command
  -spf : use fully qualified file paths
  -ssc[-] : set sensitive case mode
  -ssw : compress shared files
  -stl : set archive timestamp from the most recently modified file
  -stm{HexMask} : set CPU thread affinity mask (hexadecimal number)
  -stx{Type} : exclude archive type
  -t{Type} : Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options
  -v{Size}[b|k|m|g] : Create volumes
  -w[{path}] : assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]{@listfile|!wildcard} : eXclude filenames
  -y : assume Yes on all queries
guest@porteus:~$ 
but no Create New File under <Commands>. But creating one is possible with the Archive Manager app. :good:
Ed

donald
Full of knowledge
Full of knowledge
Posts: 2064
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

7Z - <Solved>

Post#10 by donald » 09 Nov 2022, 07:23

Code: Select all

guest@porteus:~/Test$ 7z a test.zip 1.txt 2.txt 3.txt
7z a create zip archive with name test.zip and files 1.txt 2.txt 3.txt

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

7Z - <Solved>

Post#11 by Ed_P » 09 Nov 2022, 20:36

donald wrote:
09 Nov 2022, 07:23

Code: Select all

guest@porteus:~/Test$ 7z a test.zip 1.txt 2.txt 3.txt
7z a create zip archive with name test.zip and files 1.txt 2.txt 3.txt
:good: :beer:
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

7Z new zip - <Solved>

Post#12 by Rava » 10 Nov 2022, 04:08

donald wrote:
09 Nov 2022, 07:23

Code: Select all

guest@porteus:~/Test$ 7z a test.zip 1.txt 2.txt 3.txt
7z a create zip archive with name test.zip and files 1.txt 2.txt 3.txt
it is indeed not that obvious how 7z -h phrases it

Code: Select all

<Commands>
  a : Add files to archive
that the command "a" creates a new archive … or adds file(s) to an existing archive.
Ed_P wrote:
09 Nov 2022, 06:49
Archive Manager!!! That's what zips files! :shock: Okay. Good to find that out. :happy62:
Archive Manager uses the CLI programs to do the actual work. More often than not the CLI programs themselves offer more options when using the terminal than what Archive Manager itself offers.
Still for most users what Archive Manager offers will suffice.
Cheers!
Yours Rava

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

7Z new zip - <Solved>

Post#13 by Testuser » 10 Nov 2022, 17:07

Hi Ed

You can try the below 7z GUI module I created, since I found it useful.

Hope this helps you.

Missed to post it earlier.

https://www.mediafire.com/file/3ar98vyw ... i.xzm/file
:)

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

7Z new zip - <Solved>

Post#14 by Ed_P » 10 Nov 2022, 17:52

Thank you Testuser. :) I'm not in Porteus at the moment so I will have to try it later.

Your module is 6,084 KB and I found I have an old p7zip-16.02-x86_64_ncm.xzm module in my /optional folder that is 1,976 KB.
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

7Z new zip - <Solved>

Post#15 by Rava » 10 Nov 2022, 18:40

Ed_P wrote:
10 Nov 2022, 17:52
Your module is 6,084 KB and I found I have an old p7zip-16.02-x86_64_ncm.xzm module in my /optional folder that is 1,976 KB.
I also realized that for a mere GUI for 7z 5.94 MB is much on the heavy side…
Maybe they added much stuff that is not really necessary, or newer versions of 7zip morphed into bloatware. (I do hope that's not the case!)
Cheers!
Yours Rava

Post Reply