1

Is it possible to search zipped folders for a specific file name like this?

gci $pathContainingZippedFolders -rec | ?{$_ -like "filename"}

or

gci $pathContainingZippedFolders -rec | ?{$_ -match "filename"}

Edit: I forgot to include that I was not able to do so using the above oneliners.

Edit2: I understand the pscx can be used, but I am not sure how to do that.

Edit3: I think this should work better in normal cases, but still failing to read inside the zip file(s). I will try pscx module and post an update sometime today.

gci $pathContainingZippedFolders -rec | %{$_ -match "filename"}
Animesh
  • 4,926
  • 14
  • 68
  • 110

1 Answers1

2

I can't get it to work like that. I can get this to work:

$search = "test.txt"
$sa = new-object -com shell.application
gci *.zip |%{
$path = resolve-path $_
if (($sa.namespace("$path").items() |
 select -expand name)  -contains $search){$_} 
}
mjolinor
  • 66,130
  • 7
  • 114
  • 135