locked
Help with Expand-Archive when the .zip has a variable in the filename RRS feed

  • Question

  • I'm new to Powershell and scripting and and could use some help with a script. Here is the scenario. 

     A  .zip file is created in Dir C:\Temp once daily with the name logfile******.zip

    I don't know the full name of the file but it always starts with logfile and the ****** are random numbers.

    I need to extract the contents of the .zip (which is a single txt file) to the same folder the .zip is in and then delete the .zip from that folder. I planned to use the expand-archive cmdlet to extract the contents but It doesn't support variables in the filename. I'm totally stumped on how to approach this. Any help is greatly appreciated

    Thanks,

    Wednesday, December 27, 2017 3:24 AM

All replies

  • Get-Childitem logfile*.zip | Expand-Archive

    \_(ツ)_/

    Wednesday, December 27, 2017 4:42 AM