Friday, August 14, 2015

ubuntu - 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.


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.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...