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
choose what to extract from tar archive noratx UNIX for Dummies Questions & Answers 2 03-28-2008 02:50 AM
Create Year directory, date subdirectory and archive the file madhunk UNIX for Dummies Questions & Answers 2 12-13-2007 07:25 AM
tar extract to different directory ammu UNIX for Advanced & Expert Users 1 07-25-2007 07:54 AM
extract a sub directory form a tar file Optimus_P UNIX for Advanced & Expert Users 2 01-28-2004 09:23 AM
redirecting tar extract to another directory colesy UNIX for Dummies Questions & Answers 7 01-28-2003 12:40 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-01-2004
Registered User
 

Join Date: Mar 2004
Location: Melbourne, Australia
Posts: 3
Question How to extract archive to a specified directory

Hi,

I would like to extract the files from an archive which I have copied from a different server which has different file structures to my server.

When I do a tar xvf archive_name, I get the error saying the file or directory cannot be found. How do I specify a desginated directory to hold the files being extracted.

Thanks in advance.

John
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-01-2004
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,422
To extract to a specific directory (on Linux) try

tar xzf archive.tar.gz -C somedir/

somedir must exist.
Reply With Quote
  #3 (permalink)  
Old 03-01-2004
Registered User
 

Join Date: Mar 2004
Location: Melbourne, Australia
Posts: 3
Thanks cbkihong,

I tried this:

tar xzf CDB20030623 -C /u06/keyforce/master/hist/

and I got this (I don't think it recognises the z parameter):

Usage: tar -{c|r|t|u|x} [-BdFhilmopsvw]
[-Number] [-fFile]
[-bBlocks] [-S [Feet] [Feet @Density] [Blocksb]]
[-LInputList] [-NBlocks] [-C Directory] File ...

then I tried this:

tar xvf CDB20030623 -C /u06/keyforce/master/hist/

No errors, but also no output either.

Thanks.
Reply With Quote
  #4 (permalink)  
Old 03-01-2004
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,422
Is your file b/gzipped? If not, i.e. just tar'red your command should work. Otherwise you need to gunzip it first, say

zcat gzipped_tar_file | tar xf - -C somedir/
Reply With Quote
  #5 (permalink)  
Old 03-02-2004
Registered User
 

Join Date: Mar 2004
Location: Melbourne, Australia
Posts: 3
Thanks cbkihong,

The file is not zipped. However, I have been able to work around the problem by creating a file link to the "missing directory".

Thanks again for helping.

John
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:10 PM.


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

Content Relevant URLs by vBSEO 3.2.0