Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have several RAR archives spread around multiple directories but all under a particular root folder on my Debian based NAS. Could someone help me write a simple script that would recursively go into each folder, unrar the contents, go back to the parent folder and move onto the next directory? So:

cd Photos/Summer/Italy/
unrar e Italy.rar
cd ../France/
unrar e France.rar

So just point it to root folder "Photos" and it blitzes through it unraring everything on the way...

Eg, directory structure:


Thanks in advance!

share|improve this question

2 Answers 2

up vote 7 down vote accepted
find Photos/ -name '*.rar' -execdir unrar e {} \; 
share|improve this answer
Brilliant, didn't know it was so easy! Thank you very much! –  Touff Apr 16 '12 at 23:17

If you want to move the unrar'd photos to another destination, just enter the destination in the end, like this:

find soruce/ -name '*.rar' -execdir unrar e -o- {} /new/dirr/ \;

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.