Reputation: 8704
I am looking for some example which can help me to understand how can i zip files in C# in parts i.e. if i have 20MB zip archive, I want to split the archive in 4 parts of 5MB each.
I have gone through Stack overflow question and then i even looked at DotNetZip library's documentation but i couldn't find any such example.
Could someone suggest? thanks,
What i am looking for that when i have those 4 files, I can extract them to the original files. So each individual part may not be a proper zip but all 4 parts should extract properly
Upvotes: 5
Views: 4776
Reputation: 9680
You can try ICSharpCode to zip the files. Once the file is zip you can use FileStream
to save the file in small chunks. I had done this in one of my project. If you require any help, let me know.
Upvotes: 2
Reputation: 150108
Do you mean split the ZIP file into multiple files after it has been zipped, meaning you have to re-combine both parts to have a valid ZIP?
You can accomplish this with 7Zip. Here are instructions for doing it with their UI. They also provide an API to automate the task.
http://www.linglom.com/2008/10/12/how-to-split-a-large-file-using-7-zip/
You could also just read the file as binary data, then write it to separate files using your own convention e.g. my.zip.part1of3, my.zip.part2of3, my.zip.part3of3, etc. When ready, recombine the parts and unzip. If you do this, the person re-assembling the parts would need a custom utility from you.
Upvotes: 2