Search code examples
scriptinggziparchivetar7zip

Programmatically extract tar.gz in a single step (on Windows with 7-Zip)


Problem: I would like to be able to extract tar.gz files in a single step. This makes my question almost identical to this one: Stack Overflow question for tar-gz.

My question is almost the same, but not the same, because I would like to do this on windows using 7-Zip command-line (or something similar) inside a bat file or Ruby/Perl/Python script.

Question: This seemingly simple task is proving to be more involved than the first appearance would make it out to be. Does anyone have a script that does this already?


Solution

  • 7z e example.tar.gz  && 7z x example.tar
    

    Use && to combine two commands in one step. Use the 7-Zip portable (you will need 7z.exe and 7z.dll only).