15

i'm using this command to unrar folders:

for file in *.part01.rar; do unrar x ${file}; done;

but i don't know where to add the password in this command. because right now, this command wants the password for every archive in that folder.

thanks

snickers2k
  • 856
  • 1
  • 8
  • 16

3 Answers3

18

From man unrar:

-p<password>
  Set password.

So your line would be something like:

for file in *.part01.rar; do unrar x -p<password> ${file}; done;
Zanna
  • 69,223
  • 56
  • 216
  • 327
MattJenko
  • 343
  • 2
  • 5
7

I only unrar the first part (when there are part01.rar, part02.rar, etc.) and it goes itself for the rest of the files.

unrar x An_Awesome_Movie.part01.rar -ppassword
Is Ma
  • 171
  • 1
  • 3
  • 2
    sure it is `-ppassword` not `-p password` ? also perhaps clarify which rar you use, there are two in the reposittories. – d1bro Nov 29 '18 at 01:21
  • Sure, `-pYOUPASS`, so you don't have to type it on a prompt later. I've found two, unrar-free and unrar. I use unrar. If I type just `unrar` appears a menu that says: "UNRAR 5.30 beta 2 freeware". – Is Ma Nov 29 '18 at 13:52
1
  1. Enter to the directory containing the rar file, run below cmd:

    unrar x -p /path/to/filename.rar

  2. After that, enter password into the pompt