Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7908657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:03:26+00:00 2026-06-03T12:03:26+00:00

Here is the code ZipFile zipnew = ZipFile.Read(strPath); if (!File.Exists(path)) { using (ZipFile zip

  • 0

Here is the code

ZipFile zipnew = ZipFile.Read(strPath);
if (!File.Exists(path))
{
    using (ZipFile zip = new ZipFile())
    {
        zip.Save(path);
    }
}
    string tmpname = fpath + "\\abtemp";
    ZipFile zipold = ZipFile.Read(path);
    foreach (ZipEntry zenew in zipnew)
    {
        string flna = zenew.FileName.ToString();
        string tfn = '@' + flna.Replace("\\", "/");
        Stream fstream = File.Open(tmpname, FileMode.OpenOrCreate, FileAccess.Write);
        zenew.Extract(fstream);
        string l = fstream.Length.ToString();
        fstream.Close();

        using (StreamReader sr = new StreamReader(tmpname))
        {
            var zn = zipold.UpdateEntry(flna, sr.BaseStream);
            sr.Close();
            sr.Dispose();
            fstream.Dispose();
        }
    }

    zipnew.Dispose();
    File.Delete(tmpname);
    File.Delete(strPath);

The problem is: I get no error and there are no files merged into zipold from zipnew.
Zipold is a blank zip file

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T12:03:30+00:00Added an answer on June 3, 2026 at 12:03 pm

    You’re code isn’t 100% clear to me, the variable tfn doesn’t seem to be used and i’m not quite following with all the disposes / deletes.
    But on the bright side i did get your code working, the main problem was that you’re not calling the save method of zipold.

        string path = "d:\\zipold.zip";
        ZipFile zipnew = ZipFile.Read("d:\\zipnew.zip");
        if (!File.Exists(path))
        {
            using (ZipFile zip = new ZipFile())
            {
                zip.Save(path);
            }
        }
        string tmpname = "d:" + "\\temp.dat";
        ZipFile zipold = ZipFile.Read(path);
        foreach (ZipEntry zenew in zipnew)
        {
            string flna = zenew.FileName.ToString();
            //string tfn = '\\' + flna.Replace("\\", "/"); useless line
            Stream fstream = File.Open(tmpname, FileMode.OpenOrCreate, FileAccess.Write);
            zenew.Extract(fstream);
            string l = fstream.Length.ToString();
            fstream.Close();
            using (StreamReader sr = new StreamReader(tmpname))
            {
                var zn = zipold.UpdateEntry(flna, sr.BaseStream);
                zipold.Save();
                sr.Close();
                sr.Dispose();
                fstream.Dispose();
            }
    
        }
        zipnew.Dispose();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to download .zip file format using c# code? Here is the code, i
here is code for regular expression matching #include<iostream> #include<stdio.h> #include<string.h> using namespace std; int
I'm using http://docs.python.org/library/zipfile.html to compress file into a zip. It works well but when
zip = zipfile.ZipFile(destination+ff_name,"w") zip.write(source) zip.close() Above is the code that I am using, and
I'm using the web deploy API to deploy a web package (.zip file, created
My code produces a zip file from Google App Engine for loading in a
I am trying to read a single file from a java.util.zip.ZipInputStream , and copy
we have a piece of code which generates a zip file on our system.
I am trying to stream files from a zip file using ZipEntry class in
I am FTPing a zip file from a remote FTP site using Python's ftplib.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.