繁体   English   中英

get-childitem 在不同的 zip 文件中查找特定文件

[英]get-childitem to find specific files within different zip files

我正在尝试在文件服务器上的同一文件夹中跨不同的 zip 文件处理一些标题中具有相同关键字的文件。

我有以下脚本来显示所有 zip 个文件,但是如何在所有 zip 个文件中找到标题中具有相同关键字的特定文件。

$searchinfolder = '\\fileserver\path\path2\path3\path4(here are all the sub folders where the zip files are located within)\'
Get-ChildItem -Path $searchinfolder -Recurse 

现在我想知道如何在所有 zip 个文件中找到特定文件

找到这篇文章: https://devblogs.microsoft.com/scripting/powertip-use-powershell-to-read-the-content-of-a-zip-file/

为了方便起见,我刚刚添加了一个文件路径变量,您可以将 zip 文件的路径放在那里。

$filepath = "C:\temp\zippy.zip" #declare filepath

Add-Type -assembly "system.io.compression.filesystem" #loads assembly to be able to run additional commands

[io.compression.zipfile]::OpenRead($filepath).Entries.Name #command to get filenames inside zip files

希望有帮助!

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM