After a lot of searching I was unable to find on option for 7zip to do this. I ended up writing a python script that copied what I wanted archived to another location in the hierarchy I wanted, then calling 7zip on the directory.
Question
I have a directory structure that looks like this:
SomeDir/
Subdir1/
Subdir2/
Subdir3/
each subdir contains a lot of stuff so to compress/extract Somedir
takes a long time. I want to compress each Subdir
seperately, but I need each archive to contain the path
Somedir/SubdirN/contents_of_SubdirN # for N in [1, 2, 3]
At the moment I am compressing SomeDir
then copying it 3 times, and for each archive, removing 2 of the Subdirs
. But I feel like there is a better way.
Is there some way I can either compress SubdirN
by itself, then add Somedir
to the root of the archive, and move SubdirN
into Somedir
, or compress SubdirN
specifying that it should be compressed into a directory called Somedir
?
Or possibly some other way of doing this?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow