The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unix Arithmatic operation issue , datatype issue thambi Shell Programming and Scripting 23 02-19-2008 03:19 AM
Q: tar archive help nookie UNIX for Dummies Questions & Answers 1 09-03-2007 07:30 AM
Archive (tar) dreams5617 UNIX for Dummies Questions & Answers 4 03-29-2007 05:13 AM
Archive files kayarsenal Shell Programming and Scripting 13 08-21-2006 08:01 AM
tar archive with .Z files Kun2112 UNIX for Dummies Questions & Answers 3 08-05-2005 06:42 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-11-2008
potro's Avatar
Registered User
 

Join Date: Mar 2008
Posts: 44
Tar archive issue

Hi,

I make a tar archive:
tar -czvf /path_to/cucu.tar.gz /path/dir_to_archive/

In the archive the /path/dir_to_archive/ is maintained for every file.

I need that the archive to be made without the /path/dir_to_archive/ to contain only the files in /path/dir_to_archive/.

Thanks,
Bianca
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-11-2008
Registered User
 

Join Date: Jan 2008
Posts: 30
the answer is to cd to the directory that you are archiving and do tar up the relative locations:

tar cvf /x/file.tar ./*

now when you restore you will restore your archive relative to where you are unpacking the tar ball.
Reply With Quote
  #3 (permalink)  
Old 06-11-2008
potro's Avatar
Registered User
 

Join Date: Mar 2008
Posts: 44
Quote:
Originally Posted by Grippo View Post
the answer is to cd to the directory that you are archiving and do tar up the relative locations:

tar cvf /x/file.tar ./*

now when you restore you will restore your archive relative to where you are unpacking the tar ball.
I need to tar without changing directory. And I need tar ... with zip -j the problem would be solved.

Bianca

Last edited by potro; 06-11-2008 at 05:18 AM.
Reply With Quote
  #4 (permalink)  
Old 06-11-2008
Registered User
 

Join Date: Jan 2008
Posts: 30
Quote:
Originally Posted by potro View Post
I need to tar without changing directory. And I need tar ... with zip -j the problem would be solved.

Bianca
why do you need to "tar without changing directory"?

looking back, I am not sure what the z flag is doing for you in the "tar czvf" - what flavor of UNIX are you using?
Reply With Quote
  #5 (permalink)  
Old 06-11-2008
potro's Avatar
Registered User
 

Join Date: Mar 2008
Posts: 44
Quote:
Originally Posted by Grippo View Post
why do you need to "tar without changing directory"?

looking back, I am not sure what the z flag is doing for you in the "tar czvf" - what flavor of UNIX are you using?
The archive command is included in a web page.
-z, --gzip, --ungzip
filter the archive through gzip
RH Linux

Bianca
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:07 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 Global Fact Book

Content Relevant URLs by vBSEO 3.2.0