Click to See Complete Forum and Search --> : Unraring


paintba||er
11-04-2007, 10:38 PM
Hello, I'm a complete n00b at Linux, I used Windoze my whole life until a little over a year ago when I purchased a Mac mini thinking that it would just be a toy that would never replace my Windows PC. Well, when I received it and turned it on I realized how bad Windows really was. Ever since then I've been kinda an Apple fanboy, but I've always had an interest for Linux, and have used it off and on. I've since almost completely fazed out Windows and only use it at school, when helping somebody that is having problems with it, or occasionally when I need to run a Windows only app. I now use Mac as my primary OS and Linux as my secondary. I use Mac when I need everything to just work so I can get stuff done quickly and easily, and Linux when I want to have fun screwing around with stuff and learning new things.

Anyway, now that I've said all that irrelevant stuff I can get onto the problem. I've been playing Frets On Fire (a Guitar Hero clone) and decided to download some more songs for it. So I go download a few torrents (I of course own legal copies of all the songs :rolleyes: ) and they are all RARed. No problem, I can just use unrar. But one of the torrents has each song in its own RAR archive, and there are 210 of them. It would be far too tedious to unrar each one individually. I try to recursively extract it so everything in the folder is extracted. But then I come upon the problem that each of them have files with the same name. So I need to have a folder named the same as each of the RAR archives that all of the data from each RAR archive should be extracted to. I'm not sure how to do this except manually making each folder and extracting them one by one, but I don't have time for that. I know that it could be done through a shell script, but like I said, I'm a Linux n00b, so I have no experience with writing shell scripts, and I don't think something like this would be a good place to start. :/

deathadder
11-05-2007, 05:41 AM
Is it a multi part rar? The rars named similar to "my_rar_part-001.rar" to "my_rar_part-210.rar"? I'm going to guess this is the case as multiple files can not have the same name in the same directory.

If so, you can simple run: 'unrar e my_rar_part-001.rar' and it will then extract each other rar.

If however you have multiply directories each containing a single rar file that's named the same it won't be too difficult to write a script to create directories / unrar for you, before that I just wanted to double check your problem.

retsaw
11-05-2007, 06:58 AM
Run this in the directory containing the rar files.for i in *.rar;do bn=`basename "$i" .rar`;mkdir "$bn";pushd "$bn";unrar e ../"$i";popd;doneThis is untested, but should work.

paintba||er
11-05-2007, 06:30 PM
Is it a multi part rar? The rars named similar to "my_rar_part-001.rar" to "my_rar_part-210.rar"? I'm going to guess this is the case as multiple files can not have the same name in the same directory.

If so, you can simple run: 'unrar e my_rar_part-001.rar' and it will then extract each other rar.

If however you have multiply directories each containing a single rar file that's named the same it won't be too difficult to write a script to create directories / unrar for you, before that I just wanted to double check your problem.
No, it isn't a multi part rar. They are all separate. Each one is Song_Name.rar, (each one is a different song with a different name) but each of these archives has six files: guitar.ogg, label.png, notes.mid, rhythm.ogg, song.ini, and song.ogg, which is why they must all be put in separate directories.


Run this in the directory containing the rar files.for i in *.rar;do bn=`basename "$i" .rar`;mkdir "$bn";pushd "$bn";unrar e ../"$i";popd;doneThis is untested, but should work.

Thank you very much, this worked perfectly. :)