-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05-Sep-2002/20:23 -0700, Gordon Messmer <[EMAIL PROTECTED]> wrote:
>On Thu, 2002-09-05 at 19:58, Bret Hughes wrote:
>> On Thu, 2002-09-05 at 21:01, Gordon Messmer wrote:
>> > On Thu, 2002-09-05 at 17:50, Sam Ockman wrote:
>> > > The best way to probably do this is to learn how to use the find
>> > > command.  It's complicated but should allow you to do this without
>> > > shell scripting
>> > 
>> > It would be difficult to extract the files to the correct location with
>> > "find" by itself.
>> 
>> why?  As long as you started from the same place, it seems like it would
>> work sine find will return a relative path begining with ./ on my
>> machines runing linux.  I know I am probably missing something here but
>> what?
>
>find . -name '*.tar.gz' -exec tar zxf {} \;
>
>That's what you're thinking, right?  Tar will be launched from the top
>level directory, and while it'll get the full path to the tarball, it'll
>extract all of the files at the top level.  That does not preserve the
>directory structure, as the original poster asked.

A for loop that uses the --directory option of tar and the output of
dirname would do the trick.

for tarball in `find . -name '*.tar.gz'` ; do \
 tar --directory `dirname $tarball` -zxf $tarball ; done

Tony
- -- 
Anthony E. Greene <mailto:[EMAIL PROTECTED]%3E>
OpenPGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
AOL/Yahoo Messenger: TonyG05    HomePage: <http://www.pobox.com/~agreene/>
Linux. The choice of a GNU generation <http://www.linux.org/>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Anthony E. Greene <mailto:[EMAIL PROTECTED]> 0x6C94239D

iD8DBQE9eIpfpCpg3WyUI50RArjlAKDv/bDf7rG8jaLGqGvU9ZtiT+j2+QCg+oTb
uqG6hsMJvoBdjt3t/IaG6NE=
=/y90
-----END PGP SIGNATURE-----



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to