On Mon, 2009-06-01 at 13:33 +1200, Kerry wrote:
> Hi all,
>
> What I want to do is untar multiple tarballs, the are mostly resident in the
> same directory.I did a google and came across this command for a loop:
>
> # for i in *.tar.gz; do tar -xvzf $i; done
>
> Which to me looks ok, but I've got a few questions,
> 1. is this the best way to do it?
Yup. To save typing, you don't need the '-', and probably don't need the
'z' either ( distro dependent to some extent ).
> 2. is it wise to untar multiple files at the same time?
Well, you're untaring them sequentially, not concurrently.
> 3. are there any gotchas I should know about?
Only lack of disk space normally.
> 4. if the answer to the first two above is yes can I then add to this command
> to untar reqursivly through child folders? (ie untar /downloads &&
> /downloads/extradownloads
for i in `find . -name \*tar.gz`
do
cd `basename $i`
tar xf `filename $i`
cd -
done
should do it - but I haven't tested it in any way!
>
> Kerry
hth,
Steve
--
Steve Holdoway <[email protected]>
http://www.greengecko.co.nz