How can I extract a multi-part .rar from the terminal/SSH ? Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
LeVraiRoiDHyrule
Posts: 49
Joined: Tue Apr 28, 2020 3:00 pm

How can I extract a multi-part .rar from the terminal/SSH ?

Post by LeVraiRoiDHyrule »

Hi,

I use my Pi as a download/torrent server. I have no display connect, I do everything with SSH and Transmission and Aria2 remotes.

I downloaded a bunch of multi-part .rar, but I would like to extract all the files before sending them to my PC. I searched for a rar extraction software for Debian/Raspberry, but I didn't find anything really useful, most are discontinued. I would like to be able to do everything from SSH.

Could someone help me for that ? Thanks in advance for any answer. Have a good day.
User avatar
WarHawk
Posts: 714
Joined: Thu Jul 20, 2017 8:55 am

Re: How can I extract a multi-part .rar from the terminal/SSH ?

Post by WarHawk »

I believe 7zip has an arm port, and I know if you tell it to unrar the .rar file it will automatically use the .rxx numbers after to fully extract the files

It is called p7zip-full

just do a

Code: Select all

sudo apt install p7zip-full
Once installed go into the directory where your compressed files are then

Code: Select all

p7zip -d filename.rar 
and it should do it's thing

Recommend to not bork up the torrents use option -dk to leave the original .rar files there until you want to delete them from the swarm

Code: Select all

warhawk@M-340C:~$ p7zip --help
Usage: /usr/bin/p7zip [options] [--] [ name ... ]

Options:
    -c --stdout --to-stdout      output data to stdout
    -d --decompress --uncompress decompress file
    -f --force                   do not ask questions
    -k --keep                    keep original file
    -h --help                    print this help
    --                           treat subsequent arguments as file
                                 names, even if they start with a dash
LeVraiRoiDHyrule
Posts: 49
Joined: Tue Apr 28, 2020 3:00 pm

Re: How can I extract a multi-part .rar from the terminal/SSH ?

Post by LeVraiRoiDHyrule »

Hi,
Thanks for your answer.

My rar files are named like this ____.part01.rar ____.part02.rar
When I try to execute p7zip on the first part, it tells me :
unknown suffix

What should I do ?
User avatar
Joulinar
Posts: 4129
Joined: Sat Nov 16, 2019 12:49 am

Re: How can I extract a multi-part .rar from the terminal/SSH ?

Post by Joulinar »

Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
LeVraiRoiDHyrule
Posts: 49
Joined: Tue Apr 28, 2020 3:00 pm

Re: How can I extract a multi-part .rar from the terminal/SSH ?

Post by LeVraiRoiDHyrule »

Thanks for your answer.

unrar works, but apparently it has issues with multi part rar. When I try to extract a part, it doesn't take the other parts into account. It will correctly unrar the files that are entirely in part01, but if a file is seperated between part01 and part 02, it will fail to extract it. Files that are entirely on other parts doesn't appear.
User avatar
MichaIng
Site Admin
Posts: 2771
Joined: Sat Nov 18, 2017 6:21 pm

Re: How can I extract a multi-part .rar from the terminal/SSH ?

Post by MichaIng »

We have unrar as a separate install option, which will on Raspbian (our 32-bit RPi images) install the non-free unrar from Debian:

Code: Select all

dietpi-software install 170
It has better/wider rar archive support compared to the unrar-free that is shipped with Raspbian, but I have no idea whether it supports multi-part archives or not :?.
LeVraiRoiDHyrule
Posts: 49
Joined: Tue Apr 28, 2020 3:00 pm

Re: How can I extract a multi-part .rar from the terminal/SSH ?

Post by LeVraiRoiDHyrule »

Thanks. I just installed Unrar from Dietpi-software. But I didn't understand how to use it. Just typing unrar [name of my rar file] doesn't work.

Apprently, the syntax is unrar <command> -<switch 1> -<switch N> <archive> <files...> <@listfiles...> <path_to_extract\>
What are switches ? How do I use this syntax ? Could someone give me an example ?

Thanks in advance for any answer.
User avatar
Joulinar
Posts: 4129
Joined: Sat Nov 16, 2019 12:49 am

Re: How can I extract a multi-part .rar from the terminal/SSH ?

Post by Joulinar »

can you try

Code: Select all

unrar e filename.rar
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2771
Joined: Sat Nov 18, 2017 6:21 pm

Re: How can I extract a multi-part .rar from the terminal/SSH ?

Post by MichaIng »

The man page: https://linux.die.net/man/1/unrar

So especially when there is a directory structure included, use unrar x filename.rar command. To extract to a certain directory unrar x filename.rar /path/to/dir/. Exacting only specific files from the archive and the options are mostly not required for what you want, I guress.
LeVraiRoiDHyrule
Posts: 49
Joined: Tue Apr 28, 2020 3:00 pm

Re: How can I extract a multi-part .rar from the terminal/SSH ?

Post by LeVraiRoiDHyrule »

Joulinar wrote: Thu Jan 14, 2021 1:08 pm can you try

Code: Select all

unrar e filename.rar
Thank you ! It works ! Unrar e correctly extract all the rar taking into account all the parts. Thank you so much !!!!
Have a great day and stay safe !
Post Reply