N = unzipper.Read(bytes, 0, bytes.Length)ĭts.Events.FireError(0, ex.TargetSite().ToString(), "Unable to decompress " + workFilePath + " " + ex.Message, Nothing, -1) Using unzipper As New GZipStream(compressedStream, CompressionMode.Decompress) Using compressedStream As Stream = File.Open(workFilePath, FileMode.Open, FileAccess.Read, FileShare.None) Using writer As New FileStream(uncompressedFileName, FileMode.Create) UncompressedFileName = workFilePath.Substring(0, workFilePath.Length - 3)ĭts.Events.FireInformation(0, "", "decompressing " + workFilePath + " to " + uncompressedFileName, Nothing, -1, True) If Not workFilePath.EndsWith( ".gz") Thenĭts.Events.FireInformation(0, "", workFilePath + " is not compressed skipping decompression", Nothing, -1, True) WorkFilePath = Dts.Variables( "CompressedFilePath").Value.ToString() Change it from GzipStream to ZipStream for zip files, as well as modifying the extension its expecting from ".gz" to ".zip". NET compression functionality as well (which some may consider adding in a middle man, but nonetheless.) Below is a script task which decompresses of gzip files. has some freely available native Win32 ports of zip/unzip and gzip/gunzip. There are plethora of command line decompress/decompression utilities available as candidates to unzip files in an execute package task, as noted.
0 Comments
Leave a Reply. |