How to specify relative path in 7-zip command line


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.

Best Answer

  • 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.

  • Related Question