Results 1 to 8 of 8
  1. #1


    Member Since
    Jun 15, 2013
    Posts
    6
    tar not archiving all my files
    I wanted to test some potential destructive code on a directory and all its subdirectories. So, I tarballed it and then made a copy from the tarball in a space where my code wouldn't accidentally obliterate anything that I really wanted to keep. My code seemed to work except that I noticed that certain files were not put into the tarball.

    This is what I originally did:

    Code:
     tar -czf mydirectory.tar.gz directory
    In the safe location I then did the following:

    Code:
     tar -xzf mydirectory.tar.gz
    I ran a recursive diff on the archived and original directories. This showed that certain files where missing.

    It seems that any file named .__<name>__ were not recorded in the archive. For example,

    Code:
    .__quiz__
    or

    Code:
    .__example__.
    What is tar skipping over these files? How do I get tar to include them? What other files might tar not record?

    Even if I ran tar in verbose mode, there was no message that things were being skipped over.

    UPDATE

    I installed "gnu's" version of "tar" and that works as expected. Everything is correctly archived.

    So, why doesn't the natively installed "tar" do the right thing?

  2. #2

    cradom's Avatar
    Member Since
    Feb 14, 2004
    Location
    Groves, Texas
    Posts
    4,728
    Specs:
    21in. iMac 10.11 --- HP Linux Mint 18
    From man tar:
    o Archive entries can have pathnames that include .. components. By default, tar will not extract files containing
    .. components in their pathname.

    Possibly tar will not extract dot files?

  3. #3


    Member Since
    Jun 15, 2013
    Posts
    6
    My other hidden files, "dot<name>", are all successfully copied. Only "<dot><underscore><name>" are not being copied.

  4. #4

    Raz0rEdge's Avatar
    Member Since
    Jul 17, 2009
    Location
    MA
    Posts
    9,838
    Specs:
    27" i7 iMac, 15" Macbook Pro TB, 13" Macbook Air, iPhone 6S, iPod Nano 7th Gen
    Any file that begins with <dot> is a hidden file, the characters after it, underscore and all don't matter..tar will happily save them and restore them..

    Can you try
    Code:
    tar -ztvf directory.tar.gz | grep <name>
    --
    Regards
    ...Ashwin



    Be sure to read the Community Guidelines | The more information you provide, the better answers you get, remember GIGO.

  5. #5


    Member Since
    Jun 15, 2013
    Posts
    6
    That's what I'm doing. "tar" is copying all my hidden files EXCEPT
    Code:
    .__<name>__
    files. I'm asking why this is.

  6. #6

    Raz0rEdge's Avatar
    Member Since
    Jul 17, 2009
    Location
    MA
    Posts
    9,838
    Specs:
    27" i7 iMac, 15" Macbook Pro TB, 13" Macbook Air, iPhone 6S, iPod Nano 7th Gen
    My command just lists the contents of the tarball to see if it even created it properly...I'm not on my iMac right now, but on my Linux machine I get:

    $ ls -la
    total 8
    drwxrwxr-x 2 <me> <me> 4096 Jul 2 15:34 .
    drwxrwxr-x 3 <me> <me>4096 Jul 2 15:33 ..
    -rw-rw-r-- 1 <me> <me> 0 Jul 2 15:33 bar
    -rw-rw-r-- 1 <me> <me> 0 Jul 2 15:33 foo
    -rw-rw-r-- 1 <me> <me> 0 Jul 2 15:33 .foo
    -rw-rw-r-- 1 <me> <me> 0 Jul 2 15:34 ._foobar_
    $ cd ..
    $ tar -zcf test.tar.gz test
    $ tar -ztvf test.tar.gz
    drwxrwxr-x <me>/<me> 0 2013-07-02 15:34 test/
    -rw-rw-r-- <me>/<me> 0 2013-07-02 15:33 test/.foo
    -rw-rw-r-- <me>/<me> 0 2013-07-02 15:33 test/foo
    -rw-rw-r-- <me>/<me> 0 2013-07-02 15:33 test/bar
    -rw-rw-r-- <me>/<me> 0 2013-07-02 15:34 test/._foobar_
    $ tar -ztvf test.tar.gz | grep foobar
    -rw-rw-r-- <me>/<me> 0 2013-07-02 15:34 test/._foobar_
    --
    Regards
    ...Ashwin



    Be sure to read the Community Guidelines | The more information you provide, the better answers you get, remember GIGO.

  7. #7


    Member Since
    Jun 15, 2013
    Posts
    6
    I know it works on Linux. Why not on a Mac?

    I installed "gnu"'s version of "tar" and that works as expected and archives all my files.

  8. #8

    cradom's Avatar
    Member Since
    Feb 14, 2004
    Location
    Groves, Texas
    Posts
    4,728
    Specs:
    21in. iMac 10.11 --- HP Linux Mint 18
    I'm thinking maybe Apple's version is set up to not copy files with ._ so it wont copy files like ._DStore and such. I could be wrong, just thinking off the top of my head.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. .tar files extract to where?
    By titomedia in forum macOS - Operating System
    Replies: 1
    Last Post: 07-05-2014, 09:42 AM
  2. what's a tar file?
    By newmacuser09 in forum Apple Notebooks
    Replies: 3
    Last Post: 04-18-2010, 06:10 PM
  3. Archiving files as .rar
    By gomezzzza in forum Music, Audio, and Podcasting
    Replies: 0
    Last Post: 11-24-2008, 07:32 PM
  4. Archiving files problem
    By paulville in forum macOS - Operating System
    Replies: 1
    Last Post: 08-26-2008, 11:37 AM
  5. how to open .tar.gz
    By finalfrontier in forum Switcher Hangout
    Replies: 15
    Last Post: 10-30-2007, 04:35 PM

Posting Permissions

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