I have the following code which decompress the bz2 file given to variable zipFileName
,I want to change the code to decompress in the same folder/file structure as present in .bz2 file?please suggest how to do that.
using System;
using System.IO;
using ICSharpCode.SharpZipLib.BZip2;
class Program
{
static void Main(string[] args)
{
var zipFileName = @"C:\Temp\bins-hw.2.tar.bz2";
using (FileStream fileToDecompressAsStream = System.IO.File.OpenRead(zipFileName))
{
string decompressedFileName = @"C:\Temp\ichsarp\decompressed.txt";
using (FileStream decompressedStream = File.Create(decompressedFileName))
{
try
{
BZip2.Decompress(fileToDecompressAsStream, decompressedStream, true);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
}