I can't find any way to do this after searching for hours and trying various things. I'm using rarlab's free unrar CLI on OS X. I want to extract a single folder and its contents, preserving paths, from a multi-part RAR archive. Seems like a simple enough task but… The help listing is of no help. Someone must have figured this out by now.
53 Answers
I had the answer in a comment so I will list it properly as an answer:
Answer:
unrar x volname.part001.rar /dir1/*Thanks for the input.
unrar(1) refers to /usr/doc/rar/Rar.Txt. I found two different versions of it,hereand here.
Both of them say, “When extracting or testing a multi-volume archive
you must use only the first volume name.”
So, I guess you shouldn’t be saying filename.part*.rar.
Which raises the question: can you even list the (complete) archive?
Because, if you get stuck on something tricky, you should back off
and try something simpler (crawl before you walk) to narrow down where the problem is.
That said, I would suggest something like
unrar e volname.part001.rar dir1or
unrar e volname.part001.rar dir1/or
unrar e volname.part001.rar "dir1/*"<edit>
or
unrar e volname.part001.rar dir1/*(same as the previous one, but without quotes) which is what ultimately worked for the OP.
</edit>
Use x (for extract) instead of e (for extract) if that works better for you. dir1 should maybe begin with a slash if that’s how the files appear in the archive.
Use the following command to extract rar file in destination directory
unrar -x rarfileName.rar destinationDir
I did it in Linux RHEL 6.2
2