LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Extract all archives in rar (https://www.linuxquestions.org/questions/linux-newbie-8/extract-all-archives-in-rar-645732/)

infonlinebr 05-29-2008 09:55 PM

Extract all archives in rar
 
I'm trying to extract multiple. Rar which is in a folder using the command

Code:

"rar x *.rar"
and he always answered as

Code:

[mario]$ rar x *.rar
RAR 3.30    Copyright (c) 1993-2004 Eugene Roshal    22 Jan 2004
Shareware version        Type RAR -? for help
Extracting from 001-archive.rar
No files to extract

and when I file by file with "rar x 001-archive.rar" operates normally

stress_junkie 05-29-2008 10:45 PM

Looks like a bug in the rar command line parser. I think the first thing that I would do is type
Code:

rar -?
It might present helpful information.

i92guboj 05-29-2008 11:10 PM

Quote:

Originally Posted by stress_junkie (Post 3168861)
Looks like a bug in the rar command line parser. I think the first thing that I would do is type
Code:

rar -?
It might present helpful information.

Here you can read about the issue:

http://forums.gentoo.org/viewtopic-t...wildcards.html

I always use a for loop on those cases, something like

Code:

for file in *.rar; do unrar x "$file"; done

pinniped 05-29-2008 11:15 PM

Why would you expect different behavior? 'rar' is behaving as documented in the manual.
You can do:

for X in $(ls *.rar); do rar x $X; done

i92guboj 05-29-2008 11:21 PM

Quote:

Originally Posted by pinniped (Post 3168886)
Why would you expect different behavior? 'rar' is behaving as documented in the manual.
You can do:

for X in $(ls *.rar); do rar x $X; done

I don't know what the issue is, and I really don't feel like investigating it because that's what for loops are for, anyway.

I can tell you for sure that the wildcard expansion is done at shell level, *before* rar or unrar gets into scene, so that shouldn't be a problem.

Also, I don't want to sound pedant, but I would change your for loop a bit. ls is completely unnecesary, and you should *always* quote filenames unless you are really certain that they will contain no blank spaces or the like.

Code:

for X in *.rar; do rar x "$X"; done

infonlinebr 05-30-2008 06:52 AM

It must be some permission of SSH same as those servers use a "shared" must be with something missing, but interesting this business loop, vai and help now.
Very Thanks!


All times are GMT -5. The time now is 10:27 AM.