简体   繁体   中英

How to split zip file into multiple valid zip files?

coreutils 's split can split any files. Therefore, it can split a.zip file into multiple files. But the ouput files are not valid zip files any more. This can be a problem when other output files are not available, as a single output file can not be used on its own.

This case can happen, for example, in a slow network, only some files are downloaded but other files take more time to download. But users want to see the initial transfered file.

Is there a good/concise way to split a.zip file into multiple valid.zip files?

I could make my own shell script to unzip the input.zip file and the select the appropriate subsets to compress them into multiple.zip files.

But since this task should be commonly encounted, I am wondering if there is any better way to do so. Thanks.

The zip(1) utility can take an existing zip archive, and create a new one split up into multiple files. Example:

$ zip -U -s 100k -O new.zip old.zip

will split the zip file into 100 kilobyte files named new.z01 , new.z02 , ..., new.zip . Then unzip new.zip will automatically read the split files when extracting the archive. Sometimes missing split fragments can be recovered from; read up on the -F option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM