New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

tar not archiving all my files


Post Reply New Thread Subscribe

 
Thread Tools
zapatafa

 
Member Since: Jun 15, 2013
Posts: 6
zapatafa is on a distinguished road

zapatafa is offline
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?
QUOTE Thanks
cradom

 
cradom's Avatar
 
Member Since: Feb 14, 2004
Location: Nederland, Texas
Posts: 2,996
cradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant future
Mac Specs: 21in iMac core2 Duo- 13in macbook - 10.9 on both

cradom is offline
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?
QUOTE Thanks
zapatafa

 
Member Since: Jun 15, 2013
Posts: 6
zapatafa is on a distinguished road

zapatafa is offline
My other hidden files, "dot<name>", are all successfully copied. Only "<dot><underscore><name>" are not being copied.
QUOTE Thanks
Raz0rEdge

 
Raz0rEdge's Avatar
 
Member Since: Jul 17, 2009
Location: MA
Posts: 7,407
Raz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant future
Mac Specs: 27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3

Raz0rEdge is offline
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.
QUOTE Thanks
zapatafa

 
Member Since: Jun 15, 2013
Posts: 6
zapatafa is on a distinguished road

zapatafa is offline
That's what I'm doing. "tar" is copying all my hidden files EXCEPT
Code:
.__<name>__
files. I'm asking why this is.
QUOTE Thanks
Raz0rEdge

 
Raz0rEdge's Avatar
 
Member Since: Jul 17, 2009
Location: MA
Posts: 7,407
Raz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant future
Mac Specs: 27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3

Raz0rEdge is offline
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:

Quote:
$ 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.
QUOTE Thanks
zapatafa

 
Member Since: Jun 15, 2013
Posts: 6
zapatafa is on a distinguished road

zapatafa is offline
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.
QUOTE Thanks
cradom

 
cradom's Avatar
 
Member Since: Feb 14, 2004
Location: Nederland, Texas
Posts: 2,996
cradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant future
Mac Specs: 21in iMac core2 Duo- 13in macbook - 10.9 on both

cradom is offline
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.
QUOTE Thanks

Post Reply New Thread Subscribe


« Adding ringtone to mail | What's Wrong? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
How to import .MTS files into iMovie that have been archived baz201 Movies and Video 1 01-12-2012 07:49 PM
Corrupted files lrd Internet, Networking, and Wireless 5 12-23-2010 02:15 AM
How to Transfer/Backup iPod files (Windows/Mac) fguiytr66 Images, Graphic Design, and Digital Photography 0 10-30-2010 10:31 PM
Recommend useful iPod/iPhone Manager Tools for Winodws and Mac users chaterley00 Web Design and Hosting 0 10-13-2009 12:10 AM

All times are GMT -4. The time now is 02:06 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?