I am looking for soulution how to rename files inside a 7zip archive by command line (unix).
Asked
Active
Viewed 1.3k times
10
-
I am not sure that this is programming related, and therefore doesn't belong here – musefan Jun 23 '15 at 15:43
-
Maybe youre right musefan, but I need this solutin to build some script to batch rename some files in archived files from my backup mechanism. – Maciej Płocki Jun 23 '15 at 16:00
1 Answers
13
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

aquileia
- 146
- 1
- 4
-
2Doesn't work, for this command: `7za rn main.zip main.c graph.c` I get this error: `Incorrect command line` – Tomáš Zato Jan 10 '17 at 00:22
-
`Incorrect commandline` is probably because you have too old a version - check with `7za --help` – David Fraser Aug 30 '17 at 11:17