Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Zip multiple directories into one zip file

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19389 |

    Can I zip multiple directories into one zip file while preserving their original paths ?

    Can I use QuickZip to do the above ?

    Thanks

    Mart

    Imported from legacy forums. Posted by mart (had 11606 views)

    User (Old forums)
    Member
    Post count: 23064

    can this be done?

    from the sample program that i got, i saw that the application accepts a directory as input and zips the files inside the directiory.

    can we change this to accept files instead?

    ex.

    — files to be zipped —
    c:\a.txt
    c:\inetpb\b.txt
    c:\program files\c.txt

    what do we need to change from the zip demo program?

    Imported from legacy forums. Posted by schizo (had 355 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello Mart.

    If you check QuickZip.Zip’s last parameter, it’s a <B>params</B> array of string. That means you can either pass an array of strings, each representing a folder (and optional filemask) to zip, or provide each string separetely, as in:

    QuickZip.Zip(
    @”d:\target.zip”,
    true,
    true,
    true,
    @”c:\data\firstfolder\*”,
    @”c:\data\secondfolder\*”,
    @”e:\third\*.log” );

    Imported from legacy forums. Posted by Martin (had 377 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Schizo.

    I don’t know which sample you’re talking about, but using the FileSystem, it’s as simple as calling CopyTo on each source DiskFile. Make sure to read the help for ZipArchive.BeginUpdate for an optimization tip.

    Using the QuickZip.Zip method, you must make sure to pass “false” as the recurse parameter, and pass each filename in the “params string[]” parameter, as explained in my previous post.

    Imported from legacy forums. Posted by Martin (had 356 views)

    User (Old forums)
    Member
    Post count: 23064

    i am creating a multi threaded application to zip the files. i used the codes found in zip manager example. my question now is , how can i make this faster? i am allready using the begin update function but still it is slow. the specs of each of my serevrs are dual intel zeon 3.06 with 4gig of ram. i have scsi hard drives.

    public void Build()
    {
    try
    {
    DiskFile File;
    ZippedFolder DestFolder;
    DiskFile ZipFile = new DiskFile(zipFileName);

    if( ZipFile.Exists )
    {
    ZipFile.Delete();
    }

    ZipFile.Create();

    OpenZipFile(zipFileName);

    m_zipRoot.BeginUpdate( m_zipEvents, null );
    m_zipRoot.DefaultCompressionLevel = CompressionLevel.Lowest;
    m_zipRoot.DefaultCompressionMethod = CompressionMethod.Deflated;
    m_zipRoot.AllowSpanning = true;

    string connStr = “Provider=Microsoft.Jet.OLEDB.4.0; Data Source=” + zipDBname;
    zipConnection = new OleDbConnection(connStr);
    zipConnection.Open();
    zipCommand = zipConnection.CreateCommand();
    zipCommand.CommandText = “SELECT * FROM FileInfo where ScanDuration <> -1 order by ScanDuration ” + sortOrder;
    zipReader = zipCommand.ExecuteReader();

    while(zipReader.Read())
    {
    try
    {
    zipCounter.IncrementCounter();
    File = new DiskFile(zipReader[“SourceFile”].ToString());

    string RootName = System.IO.Path.GetPathRoot(zipReader[“SourceFile”].ToString());
    string PathName = System.IO.Path.GetDirectoryName(zipReader[“SourceFile”].ToString());

    PathName = PathName.Substring(RootName.Length, PathName.Length – RootName.Length);

    // If PathName and RootName are the same, then it is safe
    // to assume that the destination is the root of the zip file,
    // therefore, we will put “\” rather than string.empty to avoid
    // errors.
    if( PathName == string.Empty )
    {
    PathName = “\\”;
    }

    DestFolder = ( ZippedFolder ) m_zipRoot.GetFolder(PathName);
    File.CopyTo(m_zipEvents, null, DestFolder, false);
    }
    catch(Exception)
    {
    Utils.LogMessage(“Zip Error: ” + zipReader[“SourceFile”].ToString());
    }
    }
    }
    catch(Exception ex)
    {
    Utils.LogMessage(“Error: ZipBuilder.Build() Zip File Generation Failed:”);
    Utils.LogMessage(“Details:” + ex.ToString());
    }
    finally
    {
    if(zipReader!=null)
    zipReader.Close();
    if(zipCommand!=null)
    zipCommand.Dispose();
    if(zipConnection!=null)
    {
    zipConnection.Close();
    zipConnection.Dispose();
    }
    // For every call to BeginUpdate, there must be a call to EndUpdate.
    m_zipRoot.EndUpdate( m_zipEvents, null );
    }
    }

    Imported from legacy forums. Posted by schizo (had 479 views)

    User (Old forums)
    Member
    Post count: 23064

    is there any room for optimization in my code?

    Imported from legacy forums. Posted by schizo (had 534 views)

    User (Old forums)
    Member
    Post count: 23064

    i thought the zip library of xceed does not have the 2gig and 65000 files limit?

    how come i got the error…

    Imported from legacy forums. Posted by schizo (had 433 views)

    User (Old forums)
    Member
    Post count: 23064

    Xceed Zip for .NET does not support the Zip64 format, only the ActiveX version currently does, thus no single file can be larger than 4 gigs, the zip file itself cannot be larger than 4 gigs, and the total number of files cannot be greater than 65535.

    As for the speed optimisations, it’s hard to tell with your code. The best bet is to email <mail>support@xceedsoft.com</mail>.

    Imported from legacy forums. Posted by Martin (had 342 views)

    User (Old forums)
    Member
    Post count: 23064

    is there a way for me to check the size of the zip file and if it is 3gig, to create a new one?

    if its 3gig already, to close the update and create a new zip file update.

    Imported from legacy forums. Posted by schizo (had 358 views)

    User (Old forums)
    Member
    Post count: 23064

    i know the allowspanning property. my problem is, i dont save the zip file in a removable or limited storage. is there a way or a property to set the maximum zip file size?

    Imported from legacy forums. Posted by schizo (had 487 views)

    User (Old forums)
    Member
    Post count: 23064

    figured it out already…

    thank you for the replies.

    Imported from legacy forums. Posted by schizo (had 390 views)

    User (Old forums)
    Member
    Post count: 23064

    is the 65,000 file count limit for the whole zip file or for each spanned zip file?

    Imported from legacy forums. Posted by schizo (had 1567 views)

    User (Old forums)
    Member
    Post count: 23064

    Maximum of 65535 files for the whole zip file.

    Imported from legacy forums. Posted by Martin (had 401 views)

    User (Old forums)
    Member
    Post count: 23064

    i thought the xceed zip for .net 2.0 already had a solution to this?
    is there a new version?

    i’m pretty sure i read it in one of your documents that there is no more zip file size limit and no more file count limit…

    Imported from legacy forums. Posted by schizo (had 661 views)

    User (Old forums)
    Member
    Post count: 23064

    This is for the ActiveX version. Those features are planed in 2005 for the .NET version.

    Imported from legacy forums. Posted by Martin (had 404 views)

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.