Can we untar a GNU TAR file using DotNetZip library

Nov 2, 2009 at 1:28 PM

Hi Can you please let me know is it possible to untar a GNU TAR file using the DotNetZip library?.

 

If it is not possible is there any other Lib in C# which can do the untar?

 

 

Thanks in advance for your time

Sumanth BR

Coordinator
Nov 3, 2009 at 2:27 AM

No - DotNetZip does not do "tar" . 

Coordinator
Nov 5, 2009 at 2:58 AM

ps: Here's a nice, easy tar library for you:

http://cheeso.members.winisp.net/srcview.aspx?dir=Tar&file=Tar.cs

Nov 5, 2009 at 3:50 AM

Hi Cheeso,

 

Thanks for the information.

Nov 16, 2009 at 9:30 AM

Hi Cheeso,

thanks for the tar library :)

i have the library compiled as tar.exe and tar.dll....

the tar.exe works perfectly...

how to create a tar from dll in vb.net?

i have  2 files in my directory ...

example for folder..

c:\temp\test

as i add the 2 files to one tar?

 

sorry for my bad english ;/

 

 

Coordinator
Nov 16, 2009 at 2:40 PM

Joe,

It takes just one line in VB.NET to make a tar archive:

     Ionic.Tar.CreateArchive(archiveName, fileNames)

If you specify the names of the files explicitly, it might look like this:

     Ionic.Tar.CreateArchive("MyArchive.tar", new String() {"file1.txt", "file2.txt"})

You should get the updated Tar.cs source, and re-build the DLL. I reworked the library to make it simpler to use, and add intellisense documentation.  It's still available at http://cheeso.members.winisp.net/srcview.aspx?dir=Tar

Good luck.

Nov 20, 2009 at 10:03 AM

Hi Cheeso,

 

gib thanks .. works perfectly... :)

Jul 30, 2010 at 7:07 PM
Edited Jul 30, 2010 at 7:20 PM

Hi there Cheeso, I just wanted to get your input / perhaps make others aware of a situation that I've run into, and my remedy of it (while im sure it's not the most efficient or the best way to handle it)

I find myself in need of regularly obtaining the 5 day outlook from NOAA's NWS service that provides GIS shapefile data.

The way they structure their .TAR files are without a PATH in them....this caused (or so it seemed to me) a problem in the library during this call:

if (!Directory.Exists(p))

   Directory.CreateDirectory(p);

contained within the List >> if wantExtract

my solution was (because I was in fact using the library in a Windows Form VB project) to add this:

caseTarEntryType.File_Contiguous:

    string p = Path.GetDirectoryName(name);

   // ALPHABETAONE ADDED on 07/30/2010 REMOVE OR CHANGE THIS IF NECESSARY

   if (p == "")

      p = System.Windows.Forms.Application.StartupPath;

   // ALPHABETAONE ADDED on 07/30/2010 REMOVE OR CHANGE THIS IF NECESSARY

   if (!Directory.Exists(p))

       Directory.CreateDirectory(p);

 

   output = _internal_GetExtractOutputStream(name);

   break;

 

 

If there is a more elegant way to handle this, (which Im sure there is since I'm not at all a C# programmer) perhaps you could implement it? Otherwise some fantastic libraries!!

 

AB1

 

P.S. This is the link of the .TAR file on their site if you want to use it as a guideline: ftp://ftp.hpc.ncep.noaa.gov/shapefiles/qpf/5day/QPF120hr_Day1-5_latest.tar