On Sunday 25 June 2006 12:27 pm, Jordan Peacock wrote: > I have this working: > > #!/bin/bash > IFS=" > " > for i in `find . -name '*.tar'`; do > case "$i" in > *.tar) > mkdir `basename "$i" .tar` > cd `basename "$i" .tar` > tar xvf ../"$i" > cd .. > mv "$i" /home/hewhocutsdown/.Trash/ > ;; > esac > done > > This works fine. I'm trying to tinker with it so that it'll do the > same with .cbt files, except they don't need the folder to be made, in > fact it's counter-productive. .cbt files are simply tar files, and > with the previous version of Gnome I could merely right-click and > extract them, but now I can't, so I may be required to rename the > extension to .tar. (a 'mv' command I'm assuming) but so far nothing's > worked. This is what I tried; > > #!/bin/bash > IFS=" > " > for i in `find . -name '*.cbt'`; do > case "$i" in > *.cbt) > mv `basename "$i" .cbt` `basename "$i" .tar` # fails > mkdir `basename "$i" .cbt` # unneeded > cd `basename "$i" .cbt` # uneeded > tar xvf ../"$i" # fails > cd .. > mv "$i" /home/user/.Trash/ # works > ;; > esac > done > > I just need tar to extract the archive in the immediate directory > (there's no chance of overwriting, so I'm not concerned with that) and > then dispose of the archive. > > Thanks thanks > > -jordan So if you need to extract all of the cbt (tar) files to the current directory why not just do something like this find . -type f -name '*.cbt' -exec tar -xvf '{}' \;