I need help with tar

Discussion in 'Site & Server Administration' started by phantom, Apr 2, 2008.

  1. #1
    If I have a directory named "foo"

    and foo has a directory "bar"

    I want to tar .czvf foo but exclude "bar"


    How would I do that?




    Thanks in advance!
     
    phantom, Apr 2, 2008 IP
  2. gate2vn

    gate2vn Peon

    Messages:
    809
    Likes Received:
    33
    Best Answers:
    1
    Trophy Points:
    0
    #2
    The "--exclude-from" parameter of tar command is what you are looking for, isn't it?
     
    gate2vn, Apr 2, 2008 IP
  3. phantom

    phantom Well-Known Member

    Messages:
    1,509
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    140
    #3
    yes it is but I can't seem to make it work...


    can you give an example syntax?
     
    phantom, Apr 2, 2008 IP
  4. gate2vn

    gate2vn Peon

    Messages:
    809
    Likes Received:
    33
    Best Answers:
    1
    Trophy Points:
    0
    #4
    cannot say why it's not working with you. You should post your command here.
    Another option: move "bar" folder out of "foo" folder, tar "foo", then move "bar" back
     
    gate2vn, Apr 2, 2008 IP
  5. phantom

    phantom Well-Known Member

    Messages:
    1,509
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    140
    #5
    I gues I don't understand the syntax

    I am trying it with different variations of

    tar czvf foo.tar.gz --exclude-from=bar foo


    where foo is the directory and bar is a directory under foo
     
    phantom, Apr 2, 2008 IP
  6. phantom

    phantom Well-Known Member

    Messages:
    1,509
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    140
    #6
    I got it..........
    in case anyone else needs it:
    tar czvf foo.tar.gz foo --exclude "bar/dirs"


    Thanks!
     
    phantom, Apr 2, 2008 IP