Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Need help to create .tar.gz with full path

    Hi all,

    I need to create .tar.gz a directory but when i am tar a directory with full path, its get compressed as full path.

    when untar the same directory, its get extracted as full path location.


    Source File location:-


    Backup Directory:-


    tar -czvf /root/Desktop/backup.tar.gz /tmp/test/backup

    After that, when i am untar the same file its get extracted as /root/Desktop/backup/ directory.

    But i need to extract as backup/ directory alone.

    Issue is when i am creating tar with full path, its get compressed as full path .tar.gz file. I dont want to tar as full path.

    Need to filter that full path when creating .tar.gz file.

    Please help me on this...


  2. #2
    Navigate to the directory in which backup resides then make your tar archive.
    cd /tmp/test
    tar -czvf /root/Desktop/backup.tar.gz backup

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Read the tar man pages - there are a gazillion tar options to deal with this stuff.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!


Posting Permissions

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