Menu

7zip extract to folder like archive name

Pilligrim
2007-10-02
2023-11-03
  • Pilligrim

    Pilligrim - 2007-10-02

    I use command line version of 7zip - 7za.exe. Pls tell me how can I extract archive in to folder like the name of archive file. For example:

    extract archive 02.10.2007boss.7z to /02.10.2007boss/file.txt

     
    • SeldomGood

      SeldomGood - 2007-10-02

      The manual is your best friend.

      Check the "-o" switch.

      To Igor Pavlov: it may be worth pointing out in the manual page for "-o", that using it with wildcard works, maybe with a simple example like:

      7z x archive.zip -o*

      Regards

       
      👍
      1
      • Pilligrim

        Pilligrim - 2007-10-03

        You are right! Wonderfull Switch :). I would tell magic switch! But from a management it is not obvious :).

        [quote]
        -o (set Output directory) switch
        Specifies a destination directory where files are to be extracted.

        This switch can be used only with extraction commands.

        Syntax
        -o{dir_path}

        {dir_path}
        This is the destination directory path. It's not required to end with a backslash.
        Example
        7z x archive.zip -oc:\Doc

        extracts all files from the archive.zip archive to the c:\Doc directory.
        [quote]

        Many thanks for the help!

         
  • kabsdk68712

    kabsdk68712 - 2022-07-19

    hey seldom god, i couldnt get the wildcard to work with -o. It threw following error when run into a folder with no subfolders.

    Command Line Error:
    Unsupported command:
    

    Is it normal wildcard and requires a folder to be there? I thought that it would automatically apply the package name to folder.

     
    • Ferneu

      Ferneu - 2023-11-03

      Just tried it using archives with folders and archives without folders. Both worked.

      By the way, thank you very much SeldomGood. Had no idea -o* was a thing. And it even supports inserting a couple of sub directories in there too, like -oa/b/c/d/*

       

      Last edit: Ferneu 2023-11-03

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.