命令行大全

zipsplit

嚯嚯 发表于 2020-07-01 18:31浏览次数:

zipsplit命令将单个zip 归档文件拆分为一组较小的zipfile。

查看英文版

目录:

1 zipsplit 运行系统环境

2 zipsplit 描述

3 分割档案

4 zipsplit 语法

5 zipsplit 示例

zipsplit 运行系统环境

Unix&Linux

zipsplit 描述

zipsplit是一个非常简单的程序,它将归档文件拆分为较小的,顺序编号的zipfile。例如,如果您需要将归档文件分成较小的归档文件以适合容量有限的可移动介质,则此命令很有用。

zipsplit不会将存档中的单个文件分成较小的部分;因此,分割后的zip文件的最小大小是原始归档文件中最大文件的大小。

zipsplit is a very simple program which will split an archive into smaller, sequentially-numbered zipfiles. This command can be useful, for instance, if you need to break an archive into smaller archives which can fit onto removable media of limited capacity.

zipsplit does not break the individual files in your archive into smaller pieces; therefore, the minimum size of the split zipfiles is the size of the largest file inside the original archive.

查看英文版

查看中文版

分割档案

假设您有一个名为archive.zip的zip文件,大小约为50 兆字节,并且想要将其拆分为不大于1兆字节的片段。您可以使用以下命令:

zipsplit -n 1048576 archive.zip

...这将告诉zipsplit创建一系列zip文件,每个zip文件的大小不超过1048576 字节(1兆字节),这些文件共同包含与archive.zip相同的文件。该命令的输出将类似于以下内容:

66 zip files will be made (70% efficiency)
creating: archive01.zip
creating: archive02.zip
creating: archive03.zip
...
creating: archive66.zip

在这种情况下,结果是66个新文件,archive01.ziparchive66.zip,它们一起包含与archive.zip相同的文件。

此过程未更改archive.zip。

Let's say you have a zipfile named archive.zip that is about 50 megabytes in size, and you want to split it into pieces that are no larger than 1 megabyte. You could use this command:

zipsplit -n 1048576 archive.zip

...which will tell zipsplit to create a sequence of zipfiles, each no larger than 1048576 bytes (one megabyte), which collectively contain the same files as archive.zip. The output of this command will look something like this:

66 zip files will be made (70% efficiency)
creating: archive01.zip
creating: archive02.zip
creating: archive03.zip
...
creating: archive66.zip

The result in this case was 66 new files, archive01.zip through archive66.zip, which together contain the same files as archive.zip.

archive.zip is unchanged by this process.

查看英文版

查看中文版

zipsplit 语法

zipsplit [-t] [-i] [-p] [-s] [-n 大小 ] [-r 房间 ] [-b 路径 ] [-h] [-v]  [-L] zipfile 
-t 报告执行拆分将需要多少文件,但实际上不拆分任何内容。
-i 创建一个名为zipsplit.idx的zip索引,并将其大小包含在第一个zip文件中。
-n size 创建不超过大小字节的压缩文件。为了使拆分成功,大小必须大于原始zipfile中的最大文件。默认值为35978字节。
-r room 将第一个拆分文件缩小房间字节。如果您打算将拆分的zip文件存储在可移动磁盘上,并且在其他软件的第一个磁盘上需要额外的空间(例如用于解压缩档案的可执行文件),则此选项很有用。room的默认值为零。
-b path 将zip文件输出到path path中。
-p 在输出的每个zip文件之间暂停。
-s 即使需要更多的zip文件,也要执行顺序拆分。换句话说,请确保拆分存档中文件的顺序与原始存档中出现的文件顺序完全匹配;拆分时,请勿“随机播放”。
-H 显示帮助消息,然后退出。
-v 显示版本信息,然后退出。
-L 显示软件许可信息,然后退出。

局限性

zipsplit不支持拆分大于2 GB的存档。

zipsplit对决定如何拆分存档几乎没有控制权。如果归档文件中的一个文件很大,则可能根本无法分割归档文件,因为zipsplit无法将单个归档文件跨越多个zipfile。

拆分文件的默认最大大小约为36 KB,按照现代标准,此文件很小。如果要创建大于36 Kb的分割,必须使用-n选项指定其他最大大小。

没有方便的方法将一组拆分的zip存档重新组合为一个统一的存档。但是,可以手动将它们连接起来,然后可以使用zip-FF选项“修复”连接的文件。例如,如果拆分文件的名称为archive01.ziparchive02.zip等,则可以使用以下命令将它们合并为一个新文件Whole.zip

猫档案* .zip> whole.zip

...然后使用以下命令“修复” whole.zip(重新构建其索引):

zip -FF whole.zip --out fixed.zip

...这将给您留下一个重新组装的档案,名称为fixed.zip

zipsplit [-t] [-i] [-p] [-s] [-n size] [-r room] [-b path] [-h] [-v] 
         [-L] zipfile
-t Report how many files it will take to perform the split, but don't actually split anything.
-i Create a zip index named zipsplit.idx, and include its size in the first zip file.
-n size Create zipfiles no larger than size bytes. For the split to be successful, size must be larger than the largest file in the original zipfile. Default is 35978 bytes.
-r room Make the first split file smaller by room bytes. This option can be useful if you intend to store the split zipfiles on removable disks, and you need extra space on the first disk for other software, such as an executable file to decompress the archives. The default value of room is zero.
-b path Output zip files into the path path.
-p Pause between each zip file that is output.
-s Perform a sequential split even if it requires more zip files. In other words, make sure that the order of files in the split archives exactly matches the order of files as they appear in the original archive; do not "shuffle them around" when splitting them up.
-h Display a help message, and exit.
-v Display version information, and exit.
-L Display software licensing information, and exit.

Limitations

zipsplit does not support splitting archives that are larger than 2 gigabytes.

zipsplit offers very little control over how it decides to split up your archive. If one of the files inside your archive is very large, you may not be able to split the archive at all, because zipsplit cannot span a single archived file across multiple zipfiles.

The default maximum size of a split file is approximately 36 kilobytes, which by modern standards is very small. If you want or need to create splits larger than 36 Kb, you must specify a different maximum size using the -n option.

There is no convenient way to re-assemble a set of split zip archives into a single unified archive. Concatenating them manually and then "fixing" the concatenated file with zip's -FF option is possible, however. For example, if your split files are named archive01.ziparchive02.zip, etc. you could concatenate them into a new file, whole.zip, with the command:

cat archive*.zip > whole.zip

...and then "fix" whole.zip (re-build its index), using the command:

zip -FF whole.zip --out fixed.zip

...which would leave you with a re-assembled archive named fixed.zip.

查看英文版

查看中文版

zipsplit 示例

zipsplit -n 2097152 /home/user/myarchive.zip

将档案文件/home/user/myarchive.zip拆分为多个较小的档案文件,每个档案文件均不大于2097152字节(2兆字节)。分割的文件将被写入当前目录。

zipsplit -p -n 2097152 /home/user/myarchive.zip

与上面的命令相同,但是在每个分割文件的创建之间暂停。如果拆分文件的目标是软盘驱动器,此命令在较旧的系统上可能很有用,因为它使您可以选择在每个拆分之间插入新的软盘。

zipsplit -b /archive -n 2097152 myarchive.zip

myarchive.zip拆分为不超过2 MB的zip 文件,然后将拆分的zipfile写入目录/ archive

zipsplit -n 2097152 /home/user/myarchive.zip

Split the archive /home/user/myarchive.zip into multiple smaller archives, each of that is no larger than 2097152 bytes (2 megabytes). The split files will be written into the current directory.

zipsplit -p -n 2097152 /home/user/myarchive.zip

Same as the above command, but pause between the creation of each split file. This command can be useful on much older systems if the destination of your split files is a floppy disk drive, as it gives you the option to insert a new floppy disk between each split.

zipsplit -b /archive -n 2097152 myarchive.zip

Split myarchive.zip into zipfiles no larger than 2 megabytes, and write the split zipfiles into the directory /archive.

查看英文版

查看中文版