The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Extracting a single file from the full backups

Discussion in 'General Discussion' started by ZeusChicago, Dec 26, 2006.

  1. ZeusChicago

    ZeusChicago Active Member

    Joined:
    Oct 9, 2005
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    I am trying to extract a single file from a WHM Full Backup tar. I know the filename I need to extract, and the directorys to reach the file, but it does not seem to be working.

    Here is what I tried (so I assuming the backup files have a differant directory struture.

    tar xvf yadayada.tar /home/userfolder/forums/Themes/babylon index.template.php
    It chugs for a while (its a 5.3 gb tar) and says it cant find the file specificed.

    Any help would be greatly apprisheated

    Z
     
  2. adept2003

    adept2003 Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    283
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ~ "/(extra|special)/data"
    tar -xvf yadayada.tar /home/userfolder/public_html/forums/Themes/babylon/index.template.php

    If that doesn't work, you should probably double-check the location of the file within the archive:
    tar -tvf yadayada.tar
     
  3. ZeusChicago

    ZeusChicago Active Member

    Joined:
    Oct 9, 2005
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    Sorry about that, I did have the public_html part in there. however, using that tar listing command (thanks) I have noticed that the backup has added a /homedir/ to the directory structure.
    so I did

    tar -xvf promose7.tar /home/promose7/homedir/public_html/forums/Themes/babylon/index.template.php

    And it still compains about not being able to find the file. I am trying this command from the /backup/daily directory logged in as root. Am I missing "period" or am I not supposed to have the leading "/" or something, or is the backup just stored weirdly and I am not able to extract 1 file out and have to do an entire restore (or just untar the whole damn mess). I would hate to do either (its a 5gb backup)

    Z
     
  4. adept2003

    adept2003 Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    283
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ~ "/(extra|special)/data"
    Get rid of the leading forward-slash.

    Check the location of the specific file: tar -tvf yadayada.tar | grep index.template.php (assuming you don't have hundreds of files named the same!)
     
  5. nazmy

    nazmy Member

    Joined:
    Oct 31, 2004
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    it should be :
    Code:
    tar -xvf yadayada.tar userfolder/homedir/public_html/forums/Themes/babylon/index.template.php
    But be careful this will be extracted in your current dir (CWD) i.e.

    if you're in root dir executing this You will find a dir called promose7 and the rest under it
     
  6. ZeusChicago

    ZeusChicago Active Member

    Joined:
    Oct 9, 2005
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    Thanks! That did the trick. It was because I was includeing /home/ in front of the user's folder.

    Proper santax is: tar -xvf {userfolder}/homedir/{entirepathtofile}

    Z


    p.s. thanks to everyone else that pitched in a comment as well!
     
  7. arkain

    arkain Well-Known Member

    Joined:
    Mar 20, 2003
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    can you extra per directory? if so, how do you do it?
     
Loading...

Share This Page