473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Tar command to extract file into another directory

23
I want to extract file into another directory using Tar command i used the following but it didn't work
Expand|Select|Wrap|Line Numbers
  1. tar xvf dir.tar -C /export/home/kinzy
i want to know how can i do this on solaris 10.
Apr 27 '13 #1
19 10153
Nepomuk
3,112 Expert 2GB
How exactly didn't it work? Were the contents unpacked to the current directory? Did you get an error message?
Apr 29 '13 #2
kinzy
23
it just give me 2 files not extracted
if i want to extract on different place i have to change the current directory to the place i want to extract on it
Apr 29 '13 #3
Nepomuk
3,112 Expert 2GB
Wait, so the command
Expand|Select|Wrap|Line Numbers
  1. tar xvf dir.tar
will extract the files in the same directory but if you add the target directory as you do in the initial post, it doesn't extract?
Apr 30 '13 #4
kinzy
23
the output of your command will extract on the same directory where i create the archive.
but the first command i wrote it didn't make anything
Apr 30 '13 #5
Rabbit
12,516 Expert Mod 8TB
Doesn't the -C option have to come before the file names?
Apr 30 '13 #6
kinzy
23
i tried
Expand|Select|Wrap|Line Numbers
  1. tar xvf -C dir.tar /export/home/kinzy 
but it gave me error
May 1 '13 #7
Rabbit
12,516 Expert Mod 8TB
The path that you pass to the -C parameter should be before the file name as well.
May 1 '13 #8
kinzy
23
like what?
i can't understand
May 1 '13 #9
Rabbit
12,516 Expert Mod 8TB
Try
Expand|Select|Wrap|Line Numbers
  1. tar xvf -C /export/home/kinzy dir.tar
May 1 '13 #10
kinzy
23
Also gave me error
error "Tar : -C: NO such file or directory"
May 2 '13 #11
Nepomuk
3,112 Expert 2GB
Damn, of course it won't work... the f option means, that the archive will be the next argument. Here, the following command should work:
Expand|Select|Wrap|Line Numbers
  1. tar xvC /export/home/kinzy -f dir.tar
May 2 '13 #12
kinzy
23
Also gave error
tar: C : unknown function modifier
May 2 '13 #13
Nepomuk
3,112 Expert 2GB
*Sigh* OK, you obviously have a different version of tar than I do, as the above command worked for me. Try the following:
Expand|Select|Wrap|Line Numbers
  1. tar xv -C /export/home/kinzy -f dir.tar
May 3 '13 #14
kinzy
23
No progress
4 files not extracted
May 3 '13 #15
Rabbit
12,516 Expert Mod 8TB
Does that directory exist? Or are you wanting tar to create it?
May 3 '13 #16
kinzy
23
the directory already exist
May 3 '13 #17
Nepomuk
3,112 Expert 2GB
Hm, just an idea: Does it help if you add a slash after the directory name? So the command would be
Expand|Select|Wrap|Line Numbers
  1. tar xv -C /export/home/kinzy/ -f dir.tar
If not, we'll need a bit of information. What OS are you running? What version of tar are you using? (Use tar --version to find that out.)
May 4 '13 #18
kinzy
23
My OS is Solaris 11
Tar version 1.23
May 6 '13 #19
Nepomuk
3,112 Expert 2GB
OK, it looks like the version of tar used in Solaris doesn't have the -C option in combination with extracting. (At least that's how I read this man page.) Therefore I'd recommend the following workaround:
Expand|Select|Wrap|Line Numbers
  1. OLD_PWD=`pwd`; cd /export/home/kinzy/; tar xvf $OLD_PWD/dir.tar; cd $OLD_PWD
May 7 '13 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: TEK | last post by:
Hello I'm wondering if anyone out there might give some input/suggestions/viewpoints around the Command pattern. In my case, the number one priority for using the pattern is undo support. Some...
8
by: Siemel Naran | last post by:
Hi. I'm writing a command shell that reads commands from standard input. At this point I have the command in a std::string. Now I want to execute this command in the shell. From the Borland...
12
by: Rhino | last post by:
I am having an odd problem: the sqlj command on my system doesn't work. I am running DB2 (LUW) V8 (FP8) on WinXP. I haven't done an sqlj program since Version 6 of DB2 (LUW) so I checked the...
2
by: micahstrasser | last post by:
I have been trying for days to send a command to the command prompt through the shell() function in vb.net. For some reason it is not working. Here is the code: Private Sub Button1_Click(ByVal...
34
by: Roman Mashak | last post by:
Hello, All! I'm implementing simple CLI (flat model, no tree-style menu etc.). Command line looks like this: <command> <param1> <param2> ... <paramN> (where N=1..4) And idea is pretty simple: ...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
0
by: czerwww | last post by:
Can someone please help me? I have class for database connection and I need set command.commandTimeout. How can I do that? Code: Imports System.Data.SqlClient Imports System.Data Public Class...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
51
by: Ojas | last post by:
Hi!, I just out of curiosity want to know how top detect the client side application under which the script is getting run. I mean to ask the how to know whether the script is running under...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.