3

I hope this doesn't break rule 2. I have a bunch of folders that all have a .rar in them and I need to extract all the files and place them in one directory. Is there an easier way to do this than by going into each directory individually? what it looks like: /dirA---->rar1; /dirB---->rar2; /dirC---->rar3 etc...

  • 2
    find . -name '*.rar' -exec unrar x {} . \; – bain Jul 30 '14 at 21:40
  • Bah I was about to post that as an answer! – ElefantPhace Jul 30 '14 at 21:41
  • 1
    This question is still open, one of you should post it as an answer so we can vote on it. Also a little bit of an explanation on what exactly the find command is doing would be nice. – Jorge Castro Jul 31 '14 at 19:30
1

You can use a pipe with xargs command like that:

find . -name *.rar|xargs -I{} unrar {}

find shows the relative path for the rar files. xargs execute for each one unrar

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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