How to rename a file inside a 7zip archive by CLI?

10,020

The Unix tool p7zip is based on 7zip and should support the same command line options, which are documented in its help file.

To rename from the CLI, you'll need version 9.30 or above, and to rename multiple files in one go you'll need at least version 15.05 (which might not yet be ported):

http://www.7-zip.org/history.txt

The syntax to rename files inside archives is

7za rn <archive_name> <src_file_1> <dest_file_1> [ <src_file_2> <dest_file_2> ... ]

It also allows to move files around, e.g. into a subdirectory:

7za rn archive.7z old.txt new/location/new.txt
Share:
10,020

Related videos on Youtube

Maciej Płocki
Author by

Maciej Płocki

I liek mudkipz

Updated on September 20, 2022

Comments

  • Maciej Płocki
    Maciej Płocki over 1 year

    I am looking for soulution how to rename files inside a 7zip archive by command line (unix).

  • Tomáš Zato
    Tomáš Zato over 7 years
    Doesn't work, for this command: 7za rn main.zip main.c graph.c I get this error: Incorrect command line
  • David Fraser
    David Fraser over 6 years
    Incorrect commandline is probably because you have too old a version - check with 7za --help