7zip: Add files to new folder in archive via command line?

Posted by cschol on Super User See other posts from Super User or by cschol
Published on 2010-03-20T03:20:35Z Indexed on 2010/03/20 3:21 UTC
Read the original article Hit count: 296

Filed under:

I am using 7zip for compressing a bunch of files.

The files are in a directory structure, like this:

MyDir\File1
MyDir\File2
MyDir\File3
MyDir\MoreFiles\File4
MyDir\MoreFiles\File5

I want to create a 7z file with the following structure via command line:

ZippedDir\File1
ZippedDir\File2
ZippedDir\File3
ZippedDir\MoreFiles\File4
ZippedDir\MoreFiles\File5

Basically, I want to zip the content of MyDir\ into a new folder called ZippedDir\. I know I could copy the content into a directory called ZippedDir\ and then zip this new directory.

However, I was wondering if there was a way to avoid this extra copy step and directly zip the content, if possible, via command line.

© Super User or respective owner

Related posts about 7zip