User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Tar question, need help Page [1]  
rynop
All American
829 Posts
user info
edit post

How do you untar a specific file to a specifc directory? Here is how you untar a specific file from within the tar, but i duno how to specify a "to" location

tar --extract --file=foo.tar dir1/conf/myprop.properties

that will create 2 dirs (dir1 and conf) and 1 file within my cwd called myprop.properties.

I want to extract myprop.properties to /home/ryan (without the dir1/conf directory structure being extracted).

Thanks in advance.

11/30/2007 12:18:55 PM

darkone
(\/) (;,,,;) (\/)
11609 Posts
user info
edit post

type the following into your terminal and read the output:

man tar

11/30/2007 12:33:54 PM

teh_toch
All American
5342 Posts
user info
edit post

I don't think tar can do this because of the file format. You can do it with cpio/pax:

pax -rs ',^dir1/conf/,,' -s ',^dir1/conf,,' -s ',^dir1,,' -f foo.tar


There is probably a better regex to do this but it works.

12/1/2007 1:48:56 AM

llama
All American
841 Posts
user info
edit post

The closest you're probalby going to be able to do is

tar -x -C /home/ryan -f foo.tar dir1/conf/myprop.properties

this will extract it to /home/ryan/dir1/conf/myprop.properties

12/1/2007 1:00:36 PM

rynop
All American
829 Posts
user info
edit post

^yep, thats what I'm doing now, wanted to avoid that if possible.

^^^I don't post here before doing research on my own, to prevent wasting others time. Thanks for wasting mine.

12/7/2007 11:12:18 AM

Rat
Suspended
5724 Posts
user info
edit post

oh, don't want to waste time un-taring files?

easy...

just change your major.. lol

[Edited on December 7, 2007 at 11:21 AM. Reason : lol]

12/7/2007 11:20:52 AM

 Message Boards » Tech Talk » Tar question, need help Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.