unixcommand-line-interfacearchive7zip

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


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


Solution

  • 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