Unix/Linux Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

learn unix and linux commands

extract a sub directory form a tar file

UNIX for Advanced & Expert Users


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-28-2004   -   Original Discussion by Optimus_P
Optimus_P's Unix or Linux Image
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
 
Join Date: May 2001
Last Activity: 24 March 2008, 9:43 PM EDT
Location: Chicago IL, USA
Posts: 1,006
Thanks: 0
Thanked 2 Times in 1 Post
extract a sub directory form a tar file

anyone know if it is possable to extract a subdirectory in a tar file.

IE

tarfile contains

parent dir
-sub dir A
-sub dir B

I want to extract sub dir B.
Sponsored Links
    #2  
Old Unix and Linux 01-28-2004   -   Original Discussion by Optimus_P
fpmurphy's Unix or Linux Image
fpmurphy fpmurphy is offline
Registered User
 
Join Date: Dec 2003
Last Activity: 12 June 2016, 11:03 PM EDT
Location: /dev/ph
Posts: 4,996
Thanks: 73
Thanked 475 Times in 437 Posts
The following should work:

tar xvf tarball subdirB

From a typical tar(1) man page:

x Extracts the named files from the tape. If a named file
matches a directory whose contents were written to the
tape, this directory is (recursively) extracted.
.....
Sponsored Links
    #3  
Old Unix and Linux 01-28-2004   -   Original Discussion by Optimus_P
Optimus_P's Unix or Linux Image
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
 
Join Date: May 2001
Last Activity: 24 March 2008, 9:43 PM EDT
Location: Chicago IL, USA
Posts: 1,006
Thanks: 0
Thanked 2 Times in 1 Post
thanks Murphy. i guess i should have read the man page a bit more carfully instead of scanning it.
Sponsored Links
Closed


Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to read and append certain files form directory lio123 Shell Programming and Scripting 2 02-09-2011 02:33 PM
Extract directory from a file path mrudula009 Shell Programming and Scripting 4 06-10-2009 02:48 AM
How to extract visually blank lines form the file hadsuresh Shell Programming and Scripting 1 06-20-2008 09:59 AM
extract last modified time of file in form of YYYYMMDD itsme_maverick Shell Programming and Scripting 3 05-28-2008 01:01 PM
extract one file form .tar.gz without uncompressing .tar.gz file balireddy_77 Shell Programming and Scripting 2 07-10-2007 05:23 AM



All times are GMT -4. The time now is 05:41 PM.