Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.