Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
1  
This is an ugly answer, but you can edit the filenames in a .rar client on windows. There is probably a way to do that in the command line version as well. –  soandos Jan 6 '12 at 21:15
    
As of Ubuntu 13.10, the default archive manager will extract the good files, then show a generic error message when at least one of the resulting filenames would be too long. Then you'll need to use one of the techniques listed in the answers to extract the long-named files. –  eksortso Dec 19 '13 at 16:05

3 Answers 3

up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
Thanks, not a bad idea. I had completely spaced that unrar might try and work with full paths rather than relative directories. Seems...strange to use the full path when that adds to issues. –  EricR Jan 6 '12 at 21:25

I had this problem with mp3s from Bandcamp - their files have the artist and the album title and the song title in the filename, so sometimes they get long!

My workaround is to the use Ark's "preview" option.

Once I have selected the offending file, and selected Preview, it then starts playing in my music player (I use Clementine). I then right click on the file in Clementine and click "show in file browser". This then opens up a file browser window showing the temp directory that the previewed file is being kept in (if you use a different music player without this option, guess you will just have to find the directory manually).

I then stop the song playing, then quickly rename it in the temp directory and cut and paste it to where I want it.

If you are too slow, then the file disappears from the temp directory and you have to start again.

Dunno if it would work for other file types.

Hope this helps anyone who came here from google like I did. As a non-techy, I did not understand what "printing the problematic file to stdout" means, but this workaround works for me!

share|improve this answer
    
Doesn't sound like a very reliable solution. –  Thomas W. Jan 20 at 20:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.