2

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.

3 Answers 3

3

You do not have to copy the files, you could instead just rename MyDir\ to ZippedDir\ while compressing, and then rename back afterwords. This still require some additional preparation and cleanup work, but it will finish instantly compared to copying the files.

0

I don't know of anyway to do this when compressing but have you thought of just zipping up the contents of MyDir and when you extract it extract it to another directory named ZippedDir?

0

You can change the internal directory name inside the created archive (without file extraction). There is 'rn' command in 7zip.

See: this answer for example.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .