SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

ExtractZip for tar files

Last post 10-20-2007 11:59 AM by vickd. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-19-2007 5:56 PM

    ExtractZip for tar files

    Hi,

    I have a set of TAR files that have several layers of folders and I am trying to extract the files within.

    My  C# code:

    fz.CreateEmptyDirectories = true;

    fz.ExtractZip((strOriginalFilename), sTargetDirectory, ""); 

     

    //the exception I get is ICSharpCode.SharpZipLib.Zip.ZipException was unhandled
      Message="Cannot find central directory"
      Source="ICSharpCode.SharpZipLib"
      StackTrace:
           at ICSharpCode.SharpZipLib.Zip.ZipFile.ReadEntries()
           at ICSharpCode.SharpZipLib.Zip.ZipFile..ctor(String name)
           at ICSharpCode.SharpZipLib.Zip.FastZip.ExtractZip(String zipFileName, String targetDirectory, Overwrite overwrite, ConfirmOverwriteDelegate confirmDelegate, String fileFilter, String directoryFilter, Boolean restoreDateTime)
           at ICSharpCode.SharpZipLib.Zip.FastZip.ExtractZip(String zipFileName, String targetDirectory, String fileFilter)
           at TCheck.TCheck.Process() in C:\Projects\Copy of TCheck\Tar.cs:line 59
           at TCheck.TCheck.Main(String[] args) in C:\Projects\Copy of TCheck\Tar.cs:line 26
           at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()

     

    I can extract files out of a ZIP file no poblem

    any ideas??

    Thansk!

     


     

    Filed under:
  • 10-20-2007 11:59 AM In reply to

    • vickd
    • Top 100 Contributor
    • Joined on 04-28-2007
    • Posts 24

    Re: ExtractZip for tar files

    A TAR archive and Zip archive have different formats - FastZip cannot read a TAR file.

    Use the TarArchive or TarInputStream classes.
     

Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.