Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

What I have tried:

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);

}
Posted
Updated 22-Jun-16 4:48am
Comments
BillWoodruff 22-Jun-16 11:12am    
A key question is whether you have complete control over the files that are in the "base" folder that you update the "other" from. If you know, at all times, exactly what files are in the base folder, and their contents, then you automatically know what needs to be updated. But, if you don't know, and possibly have to deal with zipped archives with duplicate file names, then, yes, you are going to have to unzip the archives and use some form of "diff" compare to evaluate what needs to be updated.

So, please clarify your original post.

1 solution

Basically, it simply means re-packing the file from scratch. You unpack both files, decide what should go into the target ZIP file according the criteria you formulated, create a new ZIP file from scratch. Perhaps at the end you may want to rename that resulting file to you old file, effectively losing your old file which you don't need any longer.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900