Solved

Extract multiple .tar Files from a .Zip file

Posted on 2010-09-15
5
639 Views
Last Modified: 2012-05-10
I have a zip file that I am downloading from an ftp site. Inside the zip file is a .tar file. Inside that tar file is another .tar file, and finally inside that last .tar file are 4 .txt files that are my target files. I am able to pull the files locally, but when it comes time to unzip them, using SharpZipLib, it doesn't recognize the .tar files inside the .zip. Any suggestions on how to get my 4 .txt files from inside the .zip?
0
Comment
Question by:Abacus IT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 33682262
0
 
LVL 1

Author Comment

by:Abacus IT
ID: 33682331
I've looked through that and some other links, and I found a part of SharpZipLib that should allow me to extract using a small piece of code that I will attach below. I am testing that code now to see what the outcome is.
using ICSharpCode.SharpZipLib.Tar;

        public static void Extract(string filename)
        {
            TarArchive ta = TarArchive.CreateInputTarArchive(new
            FileStream("C:/FTPFiles/Audit" + filename + ".tar", FileMode.Open, FileAccess.Read));
            ta.ExtractContents("C:/FTPFiles/Audit" + filename);
            ta.Close();
        }

Open in new window

0
 
LVL 1

Author Comment

by:Abacus IT
ID: 33682366
edit on the supplied code:

TarArchive ta = TarArchive.CreateInputTarArchive(new
            FileStream("C:/FTPFiles/Audit" + filename, FileMode.Open, FileAccess.Read));
0
 
LVL 1

Author Comment

by:Abacus IT
ID: 33682808
OK, I changed my code and will attach it. I am the problem is the sample code that I found that should be handling the extraction is giving me the following error:


Header checksum is invalid

How do I handle this?

public static void Extract(string filename)
        {
            TarArchive ta = TarArchive.CreateInputTarArchive(new FileStream(filename, FileMode.Open, FileAccess.Read));
            ta.ExtractContents("C:/FTPFiles/Audit/ ");
            ta.Close();
        }

Open in new window

0
 
LVL 1

Accepted Solution

by:
Abacus IT earned 0 total points
ID: 33683224
Solution has been found. I need to do a System extract on the original file, then call my SharpZipLib extract.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question