简体   繁体   English

Powershell从zip文件复制一些文件夹

[英]Powershell copy some folders from a zip file

I have a zip folder it contains 10-12 folders (in folders i have some file) with different names and i need to get folders and copy into destination whose name contains 'abc' or 'xyz' like that using Power Shell Scripting. 我有一个zip文件夹,其中包含10-12个具有不同名称的文件夹(在文件夹中我有一些文件),我需要获取文件夹并复制到目标名称中,该名称包含“ abc”或“ xyz”,如使用Power Shell脚本编写的那样。

Thanks in advance, Chinna V 在此先感谢Chinna V

Try this, 尝试这个,

function Extract-Zip{
param([string]$zipfilename, [string] $destination)

if(test-path($zipfilename))
{    
    $shellApplication = new-object -com shell.application
    $zipPackage = $shellApplication.NameSpace($zipfilename)
    $destinationFolder = $shellApplication.NameSpace($destination)
    $destinationFolder.CopyHere($zipPackage.Items())
}

} }

This should unzip your compressed file to the destination of your choice. 这应该将压缩文件解压缩到您选择的目标位置。 Alternatively, you can explore PS Community Extensions - http://pscx.codeplex.com 或者,您可以浏览PS社区扩展-http: //pscx.codeplex.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 powershell脚本-创建不包含某些文件和文件夹的zip文件 - powershell script - create zip file excluding some files and folders 创建zip文件的功能,不包括Powershell中的某些文件和文件夹 - Function to create zip file excluding some files and folders in Powershell Powershell-列出目录中的所有文件夹,提取每个文件夹中的最新.bak文件,将其压缩,然后将其复制到目录中 - Powershell - List all folders in a directory, pull latest .bak file in each folder, zip it, copy it to a directory 在Powershell中的一个zip文件中添加多个文件夹 - Add multiple folders in one zip file in Powershell 使用PowerShell对zip文件中的文件和文件夹进行计数 - Count files and folders in a zip file using PowerShell Powershell 脚本从文本文件复制文件夹/文件 - Powershell script to copy folders/files from text file 使用 PowerShell 将几个文件夹打包成一个 zip - Several folders into a zip with PowerShell 将同一文件复制到多个不同的文件夹PowerShell - Copy same file to multiple different folders PowerShell PowerShell如何将一个文件复制到多个文件夹 - How to copy a file to multiple folders in PowerShell 通过Powershell从zip中提取某个文件似乎不会查看子文件夹 - Extract a certain file from zip via Powershell seems like not to look in sub folders
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM