简体   繁体   English

如何将 zip 文件拆分为多个有效的 zip 文件?

[英]How to split zip file into multiple valid zip files?

coreutils 's split can split any files. coreutilssplit可以拆分任何文件。 Therefore, it can split a.zip file into multiple files.因此,它可以将一个.zip文件拆分成多个文件。 But the ouput files are not valid zip files any more.但是输出文件不再是有效的 zip 文件。 This can be a problem when other output files are not available, as a single output file can not be used on its own.当其他 output 文件不可用时,这可能是一个问题,因为单个 output 文件不能单独使用。

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?有没有一种好的/简洁的方法可以将 a.zip 文件拆分为多个有效的.zip 文件?

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. 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. zip(1)实用程序可以获取现有的 zip 归档文件,并创建一个新的文件并将其拆分为多个文件。 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 .将 zip 文件拆分为 100 KB 文件,分别命名为new.z01new.z02 、 ...、 new.zip Then unzip new.zip will automatically read the split files when extracting the archive.然后unzip new.zip会在解压压缩包的时候自动读取分割文件。 Sometimes missing split fragments can be recovered from;有时可以从中恢复丢失的拆分片段; read up on the -F option.阅读-F选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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