Ubuntu – extracting file with too long of a name

filenamesrarUbuntu

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.

Best Answer

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.

Related Question