A cozy script or simply unrar -kb
Unrar itself provides an option (-kb
) to keep broken (or incomplete) extracted files.
The thing to notice here is the exit code (3) that, different from 0, states the occurrence of an error 8-)
.
So you can simply make a script trying to extract the file until it will succeed (exit code 0).
Reading its help with man unrar
(it 's never harmful to give a couple of man at day), you may notice at least a couple of other options useful for the script, namely -o+
and -inul
to force the overwriting of the file(s) and to suppress the output.
If the script is named go.sh
you may make it executable (chmod u+x ./go.sh
) and then execute ./go.sh Myfile.part01.rar
. Note you can change the values for the sleeping time and the maximum number of allowed iterations.
#!/bin/bash
MaxCounter=5 # Max number of iteration before it exits
TimeToSleep=10m # Time to sleep between 2 iteractions
COUNTER=0
until [ $COUNTER -gt $MaxCounter ]
do
printf "### Attempt $COUNTER on $MaxCounter\t"
unrar x "$@" -kb -inul -o+ \
&& { printf "\n\n### Extraction completed\n\n ### DONE ###\n\n"; exit 0; }\
|| echo "### Extraction Not completed"
let COUNTER+=1
sleep $TimeToSleep
done
printf "\n\n### $MaxCounter iterations reached \n\n ### ERROR ### \n"
Note: As disadvantage it will overwrite each time the file... but it was what you were doing with winrar too... The good thing is that it is enough high the probability that the file is in some cache buffer and it will not be really overwritten each time...
If you are able to find a version of unrar (or another program, as e.g. 7z
...) that continues the extraction it will be more efficient without overwriting.
Edited the tags since WinRAR obviously doesn't (directly) run on Ubuntu. Speaking of which, have you tried running it via Wine? – Karan – 2015-04-15T08:26:30.830
I want to solve this with onboard-Tools, not wine or proprietary software (except unrar-nonfree)... – davidbaumann – 2015-04-15T09:01:20.720
1Have you tried
unrar x filename.part1.rar
? – Albin – 2018-10-25T11:50:02.113The command
rar x filename.part1.rar
will extract all thefilename.part*.rar
into afilename
file. – GAD3R – 2018-10-25T13:25:08.443Try to extract everything up to the missing part by
unrar x -kb myfile.rar.01
. Where-kb
stands for "Keep broken extracted files". – harrymc – 2018-10-25T17:53:13.183Is Hastur's answer not acceptable? I could try to come up with something else but the script he / she provided seems like it would do what you need. – Layne Bernardo – 2018-11-01T05:24:24.923