This worked after I used Krename to change all spaces to underscores.
#!/bin/bash
for i in `find . -name '*.tar' -o -name '*.rar' -o -name '*.zip'`; do
echo "$i"
done
After which running the full script:
#!/bin/bash
for i in `find . -name '*.tar' -o -name '*.rar' -o -name '*.zip'`; do
case "$i" in
*.tar)
mkdir `basename "$i" .tar`
cd `basename "$i" .tar`
tar xvf ../"$i"
cd ..
;;
*.rar)
mkdir `basename "$i" .rar`
cd `basename "$i" .rar`
unrar e ../"$i"
cd ..
;;
*.zip)
mkdir `basename "$i" .zip`
cd `basename "$i" .zip`
unzip -d ../"$i"
cd ..
;;
esac
done
Worked with the exception of the unzipping part
unzip -d ../"$i"
I probably made the wrong command for unzip. I'll look into that.
Notes: I did away with all the .dir ending the mkdir basename; all it
seemed to do was make all my folders have a .dir 'extension' (which
wasn't necessary). If there is a specific reason for this addition
that I'm not seeing, please inform me.
Side effects:
Underscores where spaces should be in folder names.
Not a terribly difficult problem, but if I can work it without having
to rename the files first, it'll save a lot of headache. Ed Wilts was
commenting that to do that I may need something different from 'find'.
Is there no way to work find so that it allows for spaces?
-jordan