Tar -X not working. - SUN

This is a discussion on Tar -X not working. - SUN ; Hi all. I can't seem to get the exclude function in tar to work. I'm using the form: tar -cfvX /export/home/tarfile.tar -X /tmp/excludeFile /dir1/dir2 In the exclude file I have: /dir1/dir2/dir3 /dir1/dir2/dir4 I want to archive everything in /dir1/dir2 except ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Tar -X not working.

  1. Tar -X not working.

    Hi all.
    I can't seem to get the exclude function in tar to work. I'm using
    the form:
    tar -cfvX /export/home/tarfile.tar -X /tmp/excludeFile /dir1/dir2

    In the exclude file I have:
    /dir1/dir2/dir3
    /dir1/dir2/dir4

    I want to archive everything in /dir1/dir2 except dir3 and dir4. I've
    tried this with both absolute paths and relative paths, but it never
    excludes those directories. I know questions like this are usually
    beneath you guys, but I haven't been able to find anything that's
    helped.


    Thanks


  2. Re: Tar -X not working.

    bozothedeathmachine wrote:
    > Hi all.
    > I can't seem to get the exclude function in tar to work. I'm using
    > the form:
    > tar -cfvX /export/home/tarfile.tar -X /tmp/excludeFile /dir1/dir2
    >
    > In the exclude file I have:
    > /dir1/dir2/dir3
    > /dir1/dir2/dir4


    You are repeating the "X" option

    tar -cfvX /export/home/tarfile.tar /tmp/excludeFile /dir1/dir2

  3. Re: Tar -X not working.

    Sorry. That was a typo in the post only. I was not executing the
    command like that. I executed the command exactly as you typed it.

    Ben..


  4. Re: Tar -X not working.

    bozothedeathmachine wrote:
    > Sorry. That was a typo in the post only. I was not executing the
    > command like that. I executed the command exactly as you typed it.


    works for me:

    % [/tmp/test] ls
    d1/ d2/ file1 file2

    % cat /tmp/excl
    /tmp/test/d1
    /tmp/test/d2

    % tar cfvX /tmp/test.tar /tmp/excl /tmp/test
    a /tmp/test/ 0K
    a /tmp/test/d1 excluded <<<<
    a /tmp/test/d2 excluded <<<<
    a /tmp/test/file1 0K
    a /tmp/test/file2 0K

    % tar tf /tmp/test.tar
    /tmp/test/
    /tmp/test/file1
    /tmp/test/file2

    Check that your exclude file does not have spaces, control chars, is readable, etc.

    Unrelated, but be careful when you use absolute paths with tar.
    When you are going to untar it, it will want to modify/create the absolute path.

  5. Re: Tar -X not working.

    It must be the version of tar I have then, 'cause it ain't workin. I
    was able to user gtar though. Thanks for the input everyone.


+ Reply to Thread