Considering the specific case of multi-segment ZIP files,
this is a complementary answer to the main one.
As already stated in the main answer, only some archiving tools support splitting, and the main GUI doesn't seem able to create multi-segment archives in
zip format. Alternative formats can be used though, namely
Also, only some tools can extract from multi-segment-zip-files, such as the ones discussed here: on that, see the end-note to this answer.
As the question specifically addresses the issue of handling archiving from the context menu of the file manager, I looked into some commands that could achieve the given purpose even for
zip files: such commands, if successful, could then be easily added to the file manager as context menu entries.
zip tool, multi-segment archives can be created directly with a command like
zip my_archive.zip -r <file> -s 20971519 (more details under this question), but these are not at all useful because they are not ready to be extracted (need a supplementary
zip -s 0 command to create a large 1-file extractable archive - as described here) and this limitation cannot be avoided. Sending a such multi-segment archive to somebody that doesn't know this is pointless.
As already suggested in the main answer, another way is to zip the file and then split the one-file archive with
split (or the
hjsplit GUI). (I have tested the GUI and I found it extremely slow, while for the context-menu purpose the GUI is not needed.)
The idea is to add to the context menu of the file manager an entry that, with just one click, would
- compress selected files as a single
- split the zip-file in parts of specified maximum size, and
- remove it in order to keep only the multi-file archive.
So, I have tested with Thunar and a custom action with these three commands connected by
zip -j my_archive.zip %F && split -b 20m my_archive.zip split.zip && rm my_archive.zip
(That is to be applied to one or more selected files, but not to directories; to apply to directories, the
zip -r option is needed:
zip -r -j my_archive.zip %F && split -b 20m my_archive.zip split.zip && rm my_archive.zip
-j stands for an option for
zip to "junk the path": unlike a terminal command containing the full path of the to-be-archived file(s) , a context menu command that uses
%F for selected files would add to the archive a folder-in-folder structure unless
-j is used; (source: create zip - ignore directory structure);
my_archive.zip is the custom name of the not-yet-split archive; the
split command will be applied to it and then the former will be removed with
%F can be used in a Thunar custom action in order to compress multiple files as
%f is to be used for selection of just one file;
-b 20m stands for the size of the separate archive parts created by
split as indicated here;
split.zip is a specification that is not needed; it is the custom name of the final multi-file archive, it
would give something like
split.zipaa, split.zipab, split.zipac..., and without it the output will be named
x followed by the
xaa, xab, xac..., etc; there is a
-d to use numeric suffixes instead of alphabetic, but that gives an error (because apparently the extractor expects a standard ZIP multi-segment archive when it sees a numeric suffix - as suggested in a private chat by Stephen Kitt;
rm applied to the
my_archive.zip file will only leave us with the desired multi-segment archive.
In order for the resulting multi-zip-archive to be extracted, a tool that supports
aa segmentetd archives is needed, like
file-roller in Linux and 7-Zip in Windows.