title: Converting existing function to handle multiple files to unzip
body: <p>I have an existing working code to unzip the file in gz format:</p>
  
  <pre><code>Function DeGZip-File{
      Param(
          $infile,
          $outfile = ($infile -replace '\.gz$','')
      )
  
      $input = New-Object System.IO.FileStream $inFile, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([IO.FileShare]::Read)
      $output = New-Object System.IO.FileStream $outFile, ([IO.FileMode]::Create), ([IO.FileAccess]::Write), ([IO.FileShare]::None)
      $gzipStream = New-Object System.IO.Compression.GzipStream $input, ([IO.Compression.CompressionMode]::Decompress)
  
      $buffer = New-Object byte[](1024)
      while($true){
          $read = $gzipstream.Read($buffer, 0, 1024)
          if ($read -le 0){break}
          $output.Write($buffer, 0, $read)
      }
      $gzipStream.Close()
      $output.Close()
      $input.Close()
  }
  $infile="\\loction of the file\filename.gz"
  DeGZip-File $infile
  </code></pre>
  
  <p>Is it possible to use this code to decompress all of the .gz files from the folder? And how would parameters look like to be passed to the script. I assume that now instead of the file name it should look for the input directory and destination folder.</p>