7zip – extract with specific structure and specific folder

7-zipzip

I have a zip file that people are going to upload. The structure looks like this:

file.zip
    \a bunch of directories: 
    web\ws2go-data\
    web\ws2go-data\project\
    web\ws2go-data\project\projectname\dir1
    web\ws2go-data\project\projectname\dir2

I want to copy this into a specific folder – let's say
C:\projects\projectname

but I don't want all the hierarchy

ex:

don't want: C:\projects\projectsname\web\ws2go-data\project\projectname

do want: C:\projects\projectsname\dir1

do want: C:\projects\projectsname\dir2

So far, I have something like this

cd C:\projects
7z x zip-test.zip -otest1 web/ws2go-data/project/projectname

But it gives me what I don't want. I can't figure out how to remove all the above folder structure.

Best Answer

If you use the 'e' flag with 7zip, it will extract everything to the current folder (or you can use -o to specify the folder):

cd C:\projects  
7z e zip-test.zip  

or:

7z e zip-test.zip -oC:\projects

from: https://sevenzip.osdn.jp/chm/cmdline/commands/extract.htm

Related Question