Linux – unrar all rar files in a directory with linux

debianlinuxrar

I am trying to extract many rar files at once, but with no successful. I am trying in the order:

>ls *.rar|xargs unrar x
>ls *.rar|xargs unrar e
>unrar e -r *.rar
>for f in *.rar;do unrar e “$f”;done

no ones works. Rar answers every times saying that there are not file to exctract.

>Extracting from damned_file.rar

 No files to extract

If I try to extract the file one by one, then all works fine

>unrar e damned_file.rar
 extracting damned_file.rar                        
 extracting dmaned_file.txt                            OK
 All OK
>

My version of rar is

UNRAR 4.10 freeware      Copyright (c) 1993-2012 Alexander Roshal

What I am doing wrong?

PS: The command

find . -name "*.rar" -exec unrar e {} \;

works fine, but the question remain the same. Why the previous commands fails?

Best Answer

Here is my go-to for loop:

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