Find the answer to your Linux question:
Results 1 to 3 of 3
I downloaded a little package from the 'net. I tried to extract ONE member (one file) from the archive and place it in a different directory (a directory other than ...
  1. #1
    Linux Newbie felipe1982's Avatar
    Join Date
    Oct 2006
    Posts
    164

    help with 'tar'

    I downloaded a little package from the 'net. I tried to extract ONE member (one file) from the archive and place it in a different directory (a directory other than the current one).

    felipe@anarchy:~> tar -tf bitflu-current.tgz
    bitflu.pl
    plugins/
    plugins/Bitflu/
    plugins/Bitflu/StorageFarabDb.pm
    plugins/Bitflu/Cron.pm
    plugins/Bitflu/DownloadHTTP.pm
    plugins/Bitflu/DownloadBitTorrent.pm
    plugins/Bitflu/AdminTelnet.pm
    plugins/Bitflu/SourcesBitTorrent.pm
    felipe@anarchy:~>tar -xzf bitflu-current.tgz bitflu.pl -C ./bin/

    Instead of putting the file in ./bin/ it put it in ./ (current dir) instead. I can't seem to make it put 'bitflu.pl' into ./bin/

    I read through info tar and man tar but I didn't find answers to my Q. Obviously I can just user 'mv' to move it to ./bin, but that's not quite the point. I want to learn how to do this properly, using native 'tar' commands.

    Any help is appreciated.

    tar version: tar-1.15.1-42.2@i586 opensuse 10.2

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    452
    > I can't seem to make it put 'bitflu.pl' into
    > ./bin/

    try the -O switch (save to stdout) then redirect:

    tar <blah,blah,blah> -O >./bin/bitflu.pl
    the sun is new every day (heraclitus)

  3. #3
    Linux Newbie felipe1982's Avatar
    Join Date
    Oct 2006
    Posts
    164
    I solved it:
    WRONG WAY:
    tar -xzf bitflu-current.tgz bitflu.pl -C ./bin/

    RIGHT WAY:
    tar -xzf bitflu-current.tgz -C ./bin bitflu.pl

    The "-C" has to happen BEFORE extracting the tar member.

    -that is all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...