-->

How to partially extract a folder from a 7z file u

2019-07-10 04:05发布

问题:

I'm trying to automate the install of my platform. I've made a script for compressing the build of the deployables to a 7zip file.

Now i need to uncompress partially some folders to a specific destination.

Package
-app1
--folder11
---folder111
--folder12
-app2
--folder21
--folder22
...

I need to create a powershell script to extract the content of 'app1' to a destination folder.

I've been trying to use the following command but the result is not the as i expected. I've been receiving the full path and not the content from folder11 recursivelly.

Set-Alias zip $ZipCommand
zip x $FilePath app1\folder11 -oc:DeployableFolder -r

Any ideas? Suggestions?

Thanks.

回答1:

I tried and had no issue.

set-alias zip "c:\Program Files\outils\7-Zip\7z.exe"
zip x program.7z python-core-2.6.1\lib -oc:\data

I eventually got a c:\data\python-core-2.6.1 which only contains the lib folder with all its subfolders & files.

The only difference I see is the backslash \ in the output path.

HTH