LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Super unrar??? (https://www.linuxquestions.org/questions/linux-newbie-8/super-unrar-597375/)

WildDrake! 11-05-2007 07:35 PM

Super unrar???
 
I have a directory with about 300 .rar files. Is there a way to give a single command and have them all unrar-ed in one shot?

Thanks! :study:

crenclan 11-05-2007 07:42 PM

I don't have an answer, but how did you accumulate so many ?

WildDrake! 11-05-2007 07:52 PM

It's how they were stored on a cd sent to me.

matthewg42 11-05-2007 08:09 PM

Here's how to do it with the unrar program provided by the unrar package under Ubuntu, which identifies itself like this when the --help option is passed:
Code:

UNRAR 3.70 beta 3 freeware      Copyright (c) 1993-2007 Alexander Roshal
If the files are found in the path /home/me/rarfiles, and you want to unrar them into /home/me/unrarfiles:
Code:

cd /home/me/unrarfiles
for f in /home/me/rarfiles/*.rar; do
    unrar -o+ x "$f"
done

The -o+ means to overwrite any files which already exist, so if some rar files contain files with similar names, you will end up with only the last one from the last rar file which contained that file name. Omit this and you will be prompted if there are duplicates if you want to overwrite.

WildDrake! 11-05-2007 08:48 PM

A Script!!! You wrote a little program in the immediate mode. That's cool.

But, I am stuck in multi-line (>) mode. How do I get the program to execute now?

matthewg42 11-05-2007 08:53 PM

The > will be printed if the shell is expecting the end of a quote, or a done after a do, or a fi after an if and so on. Just keep entering the mini-script and after the done it will execute.

If you really prefer it to be all on one line to avoid seeing the > prompt, you can do it like this:
Code:

cd /home/me/unrarfiles ; for f in /home/me/rarfiles/*.rar; do unrar -o+ x "$f"; done

bjb1959 11-05-2007 09:13 PM

use wine and winrar
 
You can also install wine and then download winrar and install that using the command line wine winrar.exe from the directory where you downloaded it to. It even places an icon on your desktop and works perfectly. I have used it for several years this way.

WildDrake! 11-05-2007 09:19 PM

WOW! Sweet! That worked soooo cool! I added this to my notes. Thanks!

WildDrake! 11-05-2007 09:21 PM

Thanks bjb1959, I'll keep that in mind, but I want to be completely independent of M$ when the smoke clears....

bjb1959 11-08-2007 06:33 PM

you can also use command line
 
ooops didn't see matthew's post, guess I should read first


All times are GMT -5. The time now is 06:27 PM.