The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
"include" directory is not there Katkota UNIX for Dummies Questions & Answers 10 01-01-2008 09:07 PM
include all files under a directory fredao Shell Programming and Scripting 4 12-15-2006 09:25 PM
date information of a directory gfhgfnhhn UNIX for Dummies Questions & Answers 1 06-29-2006 05:37 AM
#include? yongho UNIX for Dummies Questions & Answers 1 08-01-2005 11:55 AM
File/directory information...... Makaveli.2003 UNIX for Dummies Questions & Answers 50 02-26-2002 09:02 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-20-2008
Registered User
 

Join Date: Dec 2007
Posts: 106
Question why does tar sometimes include directory information?

hi,

say I have

dirA/file1
dirB/file2


and I tar them up, and then do

Code:
zcat Tar.tar | tar tvf -
Sometimes I will see:

dirA/
dirA/file1
dirB/
dirB/file2


yet other times I will see

dirA/file1
dirB/file2


i.e. no directory stuff

Why is this?

thanks
Reply With Quote
Forum Sponsor
  #2  
Old 07-21-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
tar has evolved over the years. The very first versions of tar did not copy directory information into the archive. The feeling was that if a directory was needed, just create it on the fly. But this lost directory ownership and permission info so it was fixed. A few current versions of tar has options to create an archive in this manner for compatibility with very old tar versions.

The way you phrase the question suggests that you thing omitting directories from a tar archive is normal or good. This is not the case.
Reply With Quote
  #3  
Old 07-22-2008
Registered User
 

Join Date: Dec 2007
Posts: 106
yes, but say I want to tar up

a/b/c/d/file1
x/y/z/file2


then if directory information is stored I will have

a/
a/b/
a/b/c/
a/b/c/d/
a/b/c/d/file1
x/
x/y/
x/y/z/
z/y/z/file2

Also, if I want to untar this and I already have these directories created on my system, then these new directory information will overwrite my directory information?

thanks
Reply With Quote
  #4  
Old 07-22-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
Quote:
Originally Posted by JamesByars View Post
Also, if I want to untar this and I already have these directories created on my system, then these new directory information will overwrite my directory information?
It should if you run it as root. Generally only root can give files away. Also if tar sets a directory to read-only, root can still put files in it. This is what tar usable to backup and restore files.
Reply With Quote
  #5  
Old 07-23-2008
Registered User
 

Join Date: Dec 2007
Posts: 106
thanks
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
tar

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0