[英]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.