7za.exe: Add files to subfolder in archive
Solution 1:
It appears that the developer himself has answered this question when you asked him:
Now there is no option for that task.
You can use additional "rn" (Rename) command to rename folder inside archive.
By experimenting, I found that alternatively, you can create the folder structure that you want to be added. Let your "staging area" refer to the place on your filesystem where you prepare the files/folders to be added... For your example, you could
- Create a new (empty)
Include
folder in your staging area. - Put any new files and subfolders you want added beneath it in the archive under there.
- Add them to the archive using the same command as in the question. (The
a
command in7za a
... means "add to archive", so it's the same command whether or not the archive exists yet.)
Using this method,
- Any files in the archive that are not in your staging area will remain intact.
- Any files/folders in the staging area, but not in the archive will be added.
- Any files in both places will be overwritten in the archive with the new one from your staging area.