julio said:
Using winrar works fine, and the file is unTarged
Hmm.
Are the file by any chance *BOTH* tarred and gzipped ?
If so then you need to gunzip before untarring.
Example below.
Arne
============================================
using System;
using System.IO;
using System.IO.Compression;
using ICSharpCode.SharpZipLib.Tar;
namespace E
{
public class Program
{
public static void Main(string[] args)
{
List();
Extract();
Console.ReadKey();
}
public static void List()
{
TarArchive ta = TarArchive.CreateInputTarArchive(new GZipStream(new
FileStream(@"C:\vir.tar.gz", FileMode.Open, FileAccess.Read),
CompressionMode.Decompress));
ta.ProgressMessageEvent += MyLister;
ta.ListContents();
ta.Close();
}
public static void Extract()
{
TarArchive ta = TarArchive.CreateInputTarArchive(new GZipStream(new
FileStream(@"C:\vir.tar.gz", FileMode.Open, FileAccess.Read),
CompressionMode.Decompress));
ta.ProgressMessageEvent += MyNotifier;
ta.ExtractContents(@"C:\vir");
ta.Close();
}
public static void MyLister(TarArchive ta, TarEntry te, string msg)
{
Console.WriteLine(te.Name + " " + te.Size + " " + te.ModTime);
}
public static void MyNotifier(TarArchive ta, TarEntry te, string msg)
{
Console.WriteLine(te.Name + " extracted");
}
}
}