@danielgek - Here is what you can use from a PowerShell standpoint:
Syntax to download a file from a site:
$source = "http://example.com/file.zip"
$destination = "c:\file.zip"
Invoke-WebRequest $source -OutFile $destination
and here's a function to unzip a file.
function Extract-Zip($file, $destination)
{
$shell = new-object -com shell.application
$zip = $shell.NameSpace($file)
foreach($item in $zip.items())
{
$shell.Namespace($destination).copyhere($item)
}
}
You can use the function in your script like so:
Extract-Zip –File “C:\file.zip” –Destination “C:\destination”
EDIT: Here's a function you can use for GZip files:
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='C:\Temp\DECfpc1new.csv.gz'
$outfile='c:\temp\DECfpc1new.csv'
DeGZip-File $infile $outfile`