Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like 7-zip and I needed it's command line today. I bumped into a problem.

Is there a way to specify a path within archive when compressing?

For example I have a file at C:\some_dir\my_file.txt. When compressing I want to specify destination path to be \other_dir\my_file.txt within archive.

Is this possible? This seems like fairly common thing to do.

share|improve this question
up vote 1 down vote accepted

Neither the 7zip utility, nor any archiver I know of supports this directly. You can, however, create a directory structure matching what you would like in the archive, copy files into place, and archive that instead... Quite sad, in any case, seeing functionality present in the GUI, yet missing on the command line.

share|improve this answer
I ran into a similar program recently and wondered... can it really be that the CLI doesn't support this? As far as I understood it, the GUI is just a front-end for the CLI... or isn't it? – Tobias Plutat Jan 27 '11 at 11:59
The GUI might be taking the same approach, just using temp files... I know for the case of 7zip, the GUI can do this, while the CLI can not. That is to say, the GUI can directly rename and move files inside an archive. – Jeremy Sturdivant Jan 27 '11 at 12:03
I believe that both CLI and GUI use the same library rather than GUI talking to cli. – Kugel Jan 27 '11 at 12:06
@Kugel, that sounds very likely. Alas, it's a shame. – Tobias Plutat Jan 27 '11 at 12:08

Your Answer


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.