0

I'm trying to some files with the same keyword in the title, across different zip files, within the same folder on a fileserver.

I've got the following script to show all zip files, but how do I find the specific file with the same keyword in the titel, across all zip files.

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

Now I want to know how I can find the specific file across all zip files

Avshalom
  • 8,657
  • 1
  • 25
  • 43
Idkmanidk
  • 1
  • 1

1 Answers1

0

Found this article: https://devblogs.microsoft.com/scripting/powertip-use-powershell-to-read-the-content-of-a-zip-file/

To make it easier I just added a filepath variable you can put the path of the zip file there.

$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

Hope that helps!