This is a quickie and I'm not 100% certain this will work, as I don't have any rar files to work with. I did create a text file named "foo off.rar" because it had a space in it, and everything seemed to work and you should be able to edit it to your needs.
#"foo oof.rar" is my example file
# let's record our current location so we can come back here
# for everything named *.rar
for line in *.rar
# everything from "do" to "done" will be performed on every rar file
# basename will take a path and give you the file name.
# if you know the file extension, add it to the end of the command
# and basename will chop it off in it's output
# this is running the command: basename "foo oof.rar" .rar
# the output should be "foo oof"
name=$(basename "$line" .rar)
# I'm not sure you want to do it this way,
# you may want to edit the next 5 lines
# but it should give you some ideas on ways to do it
# create directory "foo oof"
# move "foo oof.rar" into it
mv "$line" "$name"
# cd into it
# unrar "foo oof.rar"
"unrar e $line"
# make directory /mp3/"foo oof"/ and copy all mp3s to it
cp *.mp3 /mp3/"$name"/
# go back to the original location so we're in the
#right place to run all this again on the next rar
Hi this script looks promising but I doubt it will work with split archives such as archive.part01.rar, part02 etc. or the old naming convention archive.r01 etc.
Is there a way that you can assist with this? "To make it read or find that .r01 or part01.rar.