如何使用powershell从7z文件中部分提取文件夹 [英] How to partially extract a folder from a 7z file using powershell

查看:36
本文介绍了如何使用powershell从7z文件中部分提取文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自动安装我的平台.我制作了一个脚本,用于将可部署的构建压缩到 7zip 文件中.

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.

包装
-app1
--folder11
---文件夹111
--folder12
-app2
--folder21
--folder22
...

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

我需要创建一个 powershell 脚本来将app1"的内容提取到目标文件夹.

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

我一直在尝试使用以下命令,但结果与我预期的不一样.我一直在接收完整路径,而不是递归地接收来自 folder11 的内容.

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 app1folder11 -oc:DeployableFolder -r

有什么想法吗?建议?

谢谢.

推荐答案

我试过了,没有问题.

set-alias zip "c:Program Filesoutils7-Zip7z.exe"
zip x program.7z python-core-2.6.1lib -oc:data

我最终得到了一个 c:datapython-core-2.6.1,它只包含 lib 文件夹及其所有子文件夹 &文件.

I eventually got a c:datapython-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

这篇关于如何使用powershell从7z文件中部分提取文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆