0

So i have a zip file in a directory. This zip file contains different kind of files. When a user clicks on a button in my WPF application, the zip file needs to be updated.

It needs to check files from another zip file in another directory. If a file doesnt excist in the first zip file, it needs to copy that file from the other zip file to the new zip file.

i used the Ionic zip methode for this.

So far i just used the file.copy overwrite = true code. But when the zip file is 1gb+ it is taking very long because it just replaced the zip file.

does someone know how i can resolve this?

Greetings Thomas

UPDATE: this is the code i got so far:

private void getlocaldata()
        {

            string admindata = @"\\networklocation\test.zip";  
            string localPath = @"C:\finaldata\test.zip";   

            File.Copy(admindata, localPath, true);

        }
Thomas V
  • 151
  • 14
  • What is `file.copy overwrite = true` ? You have to [add files to zip](http://stackoverflow.com/q/22339260/1997232) instead of re-zipping all (if that is what you are doing now). Consider to add related code (how you do it now) to the question. – Sinatr Jun 06 '16 at 13:36
  • if you want to try using the default .Net Zip then you want ZipArchive see https://msdn.microsoft.com/en-us/library/system.io.compression.ziparchive%28v=vs.110%29.aspx – MikeT Jun 06 '16 at 13:43
  • Thanks for the comments guys, but do you know how i can check if a file already exist in a zip file based on the files from another zip file. – Thomas V Jun 06 '16 at 14:10

1 Answers1

1

You can use the DotNetZip library.

Check the file in the zip :

zip["Readme.txt"] = null;

But anyway you must compress files again for changing zips password. You can find examples for that here.