Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Extract multiple .tar Files from a .Zip file

Posted on 2010-09-15
5
Medium Priority
?
679 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 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 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