Loading ...
Sorry, an error occurred while loading the content.

Re: [blug-prog] Tar Without Tree

Expand Messages
  • Chirag Kantharia
    ... Did you check the man page of tar? Did you see -C option? chyrag. -- Chirag Kantharia, symonds.net/~chyrag/ Linux scrooge 2.4.17 #2 Mon Dec 24 12:46:20 IST
    Message 1 of 7 , Jan 7, 2002
    • 0 Attachment
      On Mon, Jan 07, 2002 at 02:12:18PM +0530, Rati Naren wrote:
      | I want to tar only the junk directory. But I cannot change over to the tmp1 directory (As I am doing this through a cgi script ). So as a result when I untar, I get the whole tree ie /tmp/tmp1/junk. I don't want this.

      Did you check the man page of tar? Did you see -C option?

      chyrag.
      --
      Chirag Kantharia, symonds.net/~chyrag/
      Linux scrooge 2.4.17 #2 Mon Dec 24 12:46:20 IST 2001 i686 unknown
    • Rati Naren
      Yeah I saw the option. But was not really able to use it. How do I tar it? It gives errors with this.. tar -C /tmp/tmp1/junk -cvf junk.tar /tmp/tmp1/junk
      Message 2 of 7 , Jan 7, 2002
      • 0 Attachment
        Yeah I saw the option. But was not really able to use it. How do I tar it?
        It gives errors with this..
        tar -C /tmp/tmp1/junk -cvf junk.tar /tmp/tmp1/junk

        How else can I use it.

        -Rati



        Did you check the man page of tar? Did you see -C option?
        chyrag

        linux-bangalore-programming@yahoogroups.com wrote:
        On Mon, Jan 07, 2002 at 02:12:18PM +0530, Rati Naren wrote:
        | I want to tar only the junk directory. But I cannot change over to the tmp1 directory (As I am doing this through a cgi script ). So as a result when I untar, I get the whole tree ie /tmp/tmp1/junk. I don't want this.

        
        .

        Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com

        Buy Music, Video, CD-ROM, Audio-Books and Music Accessories from http://www.planetm.co.in
      • Pallav Nawani
        ... try: tar -cv -C /tmp/tmp1/junk -f junk.tar /tmp/tmp1/junk regards, Pallav. _______________________________________________________________________ The five
        Message 3 of 7 , Jan 7, 2002
        • 0 Attachment
          On Mon, 7 Jan 2002, Rati Naren wrote:

          > Yeah I saw the option. But was not really able to use it. How do I tar it?
          > It gives errors with this..
          > tar -C /tmp/tmp1/junk -cvf junk.tar /tmp/tmp1/junk
          >
          > How else can I use it.
          >
          > -Rati

          try:
          tar -cv -C /tmp/tmp1/junk -f junk.tar /tmp/tmp1/junk


          regards,
          Pallav.

          _______________________________________________________________________
          The five rules of Socialism:
          (1) Don't think.
          (2) If you do think, don't speak.
          (3) If you think and speak, don't write.
          (4) If you think, speak and write, don't sign.
          (5) If you think, speak, write and sign, don't be surprised.
          -- being told in Poland, 1987
          _________________________________________________________________
          | |
          |Pallav Nawani |
          |Sasken Communication Technologies Ltd. |
          |Domlur, Bangalore. |
          |Personal Web Page: http://members.dencity.com/pallavnawani |
          |_______________________________________________________________|
        • Rati Naren
          Thanks !!! It worked & I got it :) Rati Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com Buy Music, Video, CD-ROM, Audio-Books and
          Message 4 of 7 , Jan 7, 2002
          • 0 Attachment
            Thanks !!! It worked & I got it :)

            Rati

            Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com

            Buy Music, Video, CD-ROM, Audio-Books and Music Accessories from http://www.planetm.co.in
          • Chirag Kantharia
            ... This would not work. -C works like with gmake/make. It changes to the directory before performing make or tar. tar -cv -C /tmp/tmp1/junk -f junk.tar
            Message 5 of 7 , Jan 7, 2002
            • 0 Attachment
              On Mon, Jan 07, 2002 at 03:34:20PM +0530, Pallav Nawani wrote:
              | > Yeah I saw the option. But was not really able to use it. How do I tar it?
              | > It gives errors with this..
              | > tar -C /tmp/tmp1/junk -cvf junk.tar /tmp/tmp1/junk
              | try:
              | tar -cv -C /tmp/tmp1/junk -f junk.tar /tmp/tmp1/junk

              This would not work. -C works like with gmake/make. It changes to the
              directory before performing make or tar.

              tar -cv -C /tmp/tmp1/junk -f junk.tar /tmp/tmp1/junk
              ^^^^^^^^^^^^^^^^^
              This will cause it to change directory to /tmp/tmp1/junk

              -f junk.tar would create the junk.tar (in /tmp/tmp1/junk, which is the
              current directory)

              But the final argument, /tmp/tmp1/junk would include the preceding
              tmp/tmp1/junk, which Rati doesn't want.

              The correct way to do it, would be:

              tar -cv -C /tmp/tmp1 -f /tmp/junk.tar junk

              chyrag.
              --
              Chirag Kantharia, symonds.net/~chyrag/
              Linux scrooge 2.4.17 #2 Mon Dec 24 12:46:20 IST 2001 i686 unknown
            • Pallav Nawani
              ... true. I should have thought a little bit before posting. regards, Pallav. _______________________________________________________________________
              Message 6 of 7 , Jan 7, 2002
              • 0 Attachment
                On Mon, 7 Jan 2002, Chirag Kantharia wrote:

                >
                > But the final argument, /tmp/tmp1/junk would include the preceding
                > tmp/tmp1/junk, which Rati doesn't want.
                >
                > The correct way to do it, would be:
                >
                > tar -cv -C /tmp/tmp1 -f /tmp/junk.tar junk
                >
                > chyrag.

                true. I should have thought a little bit before posting.


                regards,
                Pallav.

                _______________________________________________________________________
                _________________________________________________________________
                | |
                |Pallav Nawani |
                |Sasken Communication Technologies Ltd. |
                |Domlur, Bangalore. |
                |Personal Web Page: http://members.dencity.com/pallavnawani |
                |_______________________________________________________________|
              Your message has been successfully submitted and would be delivered to recipients shortly.