Debian: UnRAR multiple files with password
by admin on Jul.01, 2012, under Linux (Ubuntu)
This article describes how I usually unpack multiple password protected rar archives in Linux from a terminal. The reason one would ever need to do this is I do have lots of rar archives on my Debian box which are protected by the same password. Unfortunately there’s no graphical user interface available on my server and I therefore have to unpack them using the command line.
I am using the nonfree version of RAR for Linux. If you’re using the free version you’ll simply have to replace rar x with unrar e as far as I remember.
This is the command I’m using:
for f in *.rar;do rar x -pMYPASSWORD "$f";done
It will seek for all files ending with .rar in the current directory and will extract the archives with the provided password.
Update
There’s an even shorter solution:
rar x -p"mypassword" '*.rar'
October 12th, 2016 on 00:42
Hi! I had tried that “same” line before, unsuccessfully… BUT putting *.rar between apostrophos is PURE GENIUS!!! Incredibly, it works! Thank you so much!