extracting file with too long of a name

I have a rar archive that I downloaded, except some of the filenames are too long to be created by ubuntu. How can I extract all of the files?

The default archive manager on ubuntu goes through most of the files, fails, and deletes the entire folder. Ark extracts them and silently fails on names that are too long.


The usual filesystem limitation of 255 chars applies to unique file or directory names, not their entire path. So extracting it to /a won't help. The problem is that the RAR file format allows the archive to contain files which name can exceed 255 chars.

You can work around this problem by printing the problematic file to stdout and redirecting it to a file:

unrar -inul p archive.rar overly-long-file-name > shorter-name

This extracts overly-long-file-name from archive.rar, into a file named shorter-name.


you could try & shorten the path it has to work with... in a shell i.e.:

mkdir /a; cd /a
unrar /path/to/file/with/long/names .

(make sure you sudo su - in ubuntu or you won't have sufficient privileges to write to the root dir.)

instead of trying to extract files to some directory like /long/directory/name/some/path/where/fish/live/ ... you should be able to extract them to a short dir like /a

from there... you should be able to manipulate your files however you need... and/or put them where they should go. Just remember to clean-up your / by removing the temporary directory.