26

If you right click a file in Nautilus and select Compress, then you get a dialog where you can choose a compression format and a filename. If you click on Advanced, then there are settings to split and compress the file, but it's deactivated/insensitive. How come and how do I activate those features?

Edit: In an answer below, it has been suggested that it has something to do with rar. But I have that installed, and I don't get the options to split.

2
  • Where is 'compress' did they remove that feature?
    – user56413
    Apr 24, 2012 at 15:09
  • No. Right above Properties. Apr 25, 2012 at 7:48

5 Answers 5

19
+50

Only some archiving tools support splitting. One of them is RAR -- package rar (but it's shareware and you need to buy it after 40 days -- Shareware in Ubuntu repositories? (RAR)) and another is for example 7zip -- package p7zip-full. You need to install one of them (I suggest 7zip because it's completely free).

You can also create a sigle archive and then split it into parts using split command (or HJSplit for GUI).

4
  • 2
    when I installed p7zip, then I could split the file if I choose 7z. If I install p7zip-full, then I can also password protect it. So, in that regard, my question is sort of solved. But I still can't select rar. Aug 19, 2011 at 7:43
  • And do you have package rar installed? Packages unrar and unrar-free are only for RAR decompress support. Aug 19, 2011 at 8:43
  • As for multiple zip files , 7-Zip in Wine/Playonlinux seems the easiest way (as I failed trying the zip command for the given purpose, as indicated here; such command, if successful, could be then added to the file-manger's context menu). Creating a big zip and then using hjsplit to split that, as indicated above, is a way to go (the resulting zip files can be extracted directly as the original unarchived file), but splitting an archive seems a much slower procedure than direct multi-file archiving.
    – user47206
    Sep 19, 2017 at 9:49
  • Looking into zip files in this context, it seems that the zip command can be used to create multiple-volume zip archives, only that the results are not very useful, as the multi-file zip archive cannot be extracted directly, but needs to be composed as one file through a second command before extraction: more here and here. Creating one archive and then splitting it with split is preferable.
    – user47206
    Sep 19, 2017 at 12:26
8

To activate the split option, select .rar from the file extension drop-down box.

enter image description here

3
  • 4
    I can't select rar, even though I have unrar installed. Jul 27, 2011 at 18:17
  • 2
    @Jo-ErlendSchinstad you must install rar first: apt-get install rar. Hope this late comment can help others. Aug 1, 2014 at 3:33
  • Selecting 7z also worked for me.
    – user47206
    Sep 19, 2017 at 8:58
1

Try replacing rar by unrar-free or the other wise around.

This can be done by simply

sudo apt-get install rar unrar-free
2
  • This doesn't let you create rar files...only extract them.
    – Cerin
    Aug 1, 2014 at 19:53
  • As said in a comment by Fernando Kosh , rar is also needed; sudo apt-get install rar. Selecting 7z also worked for me.
    – user47206
    Sep 19, 2017 at 8:57
1

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 rar and 7z.

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.

Considering the 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

  1. compress selected files as a single zip file,
  2. split the zip-file in parts of specified maximum size, and
  3. 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 rm

  • %F can be used in a Thunar custom action in order to compress multiple files as zip; alternatively, %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 aa fragment-suffixes: xaa, xab, xac..., etc; there is a split option -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.


Note:

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.

-1

Using p7zip-full, as Vojtech Trefny suggested, works, but didn't enable me to choose rar as compression method. Neither did unrar. However, installing the package "rar" does present that option, and if you open Advanced, all options are sensitive.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .