Untar to a particular directory is Failing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Untar to a particular directory is Failing
# 1  
Old 07-18-2017
Hammer & Screwdriver Untar to a particular directory is Failing

Below are my system and tar details.

Code:
bash-3.2$ uname -a
SunOS mymac 5.10 Generic_150400-40 sun4v sparc sun4v
bash-3.2$ which tar
/usr/bin/tar

I use this command to untar at the file at this location: /web/applications/configurations

Code:
tar -xvf bent.tar -C /web/applications/configurations

and
Code:
tar -xvf bent.tar --directory /web/applications/configurations

MAN page shows the following explaining

Quote:
-C directory file Performs a chdir (see cd(1)) opera-
tion on directory and performs the c
(create) or r (replace) operation on
file. Use short relative path names
I wish to give the complete physical path to the directory location where I wish to untar.

echo $? shows the tar command as successful but nothing is extracted at the destination. Also the command completes promptly as though it did nothing.

Can you please suggest a solution ?
# 2  
Old 07-18-2017
try tar -tvf bent.tar and see what's inside the tarball...
# 3  
Old 07-18-2017
If this is a Solaris system then please try omitting the '-' from the command line, e.g.,

Code:
# tar xvf <whatever>

I'm just suspicious that the '-' is maybe confusing the OS somehow (or perhaps not). Just try it and see what happens and whether it complains.
# 4  
Old 07-18-2017
Tools

Quote:
Originally Posted by hicksd8
If this is a Solaris system then please try omitting the '-' from the command line, e.g.,

Code:
# tar xvf <whatever>

I'm just suspicious that the '-' is maybe confusing the OS somehow (or perhaps not). Just try it and see what happens and whether it complains.
No complaints after removing the '-' but same result ... nothing gets extracted at the given location.

Other suggestions please.

---------- Post updated at 10:17 AM ---------- Previous update was at 10:15 AM ----------

Quote:
Originally Posted by vgersh99
try tar -tvf bent.tar and see what's inside the tarball...
The tar ball has several files and folders .... It works when I don't specify the destination i.e. extract it at the same location.

Also
Code:
bash-3.2$ du -sh bent.tar
 228M   bent.tar

Other suggestions please.
# 5  
Old 07-18-2017
So back to vgersh99's suggestion, let's list the archive to see if it contains what you expect:

# tar tvf bent.tar

Make a note of the path names listed and particularly whether they start with a '.' (dot - meaning a relative path)
# 6  
Old 07-18-2017
Tools

Quote:
Originally Posted by hicksd8
So back to vgersh99's suggestion, let's list the archive to see if it contains what you expect:

# tar tvf bent.tar

Make a note of the path names listed and particularly whether they start with a '.' (dot - meaning a relative path)
The listing is too big to paste here ... but here is what it looks like.

Code:
bash-3.2$ tar -tvf bent.tar
drwxr-xr-x   0/0        0 Apr 18 00:28 2017 bent/
-rw-r--r--   0/0     5926 Jul 18 03:56 2017 bent/999/Center.xml
-rw-r--r--   0/0      758 Jul 18 03:56 2017 bent/999/Produc.xml
-rw-r--r--   0/0     2673 Jul 18 03:56 2017 bent/999/bent_logo.gif
-rw-r--r--   0/0    49598 Jul 18 03:56 2017 bent/999/documents/xyz_version.pdf
-rw-r--r--   0/0       25 Jul 18 03:56 2017 bent/999/roll/auto.jsp
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/002/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/002/LEGAL/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/003/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/003/LEGAL/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/007/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/007/LEGAL/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/021/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/021/LEGAL/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/021/documents/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/024/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/024/documents/
drwxr-xr-x   0/0        0 Mar 21 03:17 2017 bent/027/
drwxr-xr-x   0/0        0 Mar 21 03:17 2017 bent/027/documents/
drwxr-xr-x   0/0        0 Jul 18 03:56 2017 bent/028/
......
......
-rw-r--r--   0/0   104727 Jul 18 03:56 2017 bent/inquiry/Formar.xsl
-rw-r--r--   0/0     9105 Jul 18 03:56 2017 bent/inquiry/Trer.xsl
bash-3.2$

Can you please suggest now ?
# 7  
Old 07-18-2017
Untar to a particular directory is Failing

tar -xvf bent.tar -C /web/applications/configurations
and the path /web/applications/configurations exists AND has the proper permissions?
Try untarring it under a diff directory - say /tmp

Last edited by vgersh99; 07-18-2017 at 01:07 PM..
This User Gave Thanks to vgersh99 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to Untar tar.gz to particular directory

Hi Guys, I am able to untar a tar.gz file. But it is again extracting the tar file to further child directory. I even tried the below command to untar it to particular directory. tar -zxvf gme_dly_sls_20120515035335.txt.tar.gz -C /sites/VSTAR/site/live/ftp/GMEUROPE I am getting the below... (4 Replies)
Discussion started by: mac4rfree
4 Replies

2. Solaris

Unable to Untar

Hello, bash-2.05# tar -xvf sunos.tar tar: directory checksum error bash-2.05# file sunos.tar sunos.tar: data bash-2.05# Can someone please help me untar this. This is a Solaris 9 box. (5 Replies)
Discussion started by: zigi_p5
5 Replies

3. Solaris

zip -r <directory> failing due to 2GB limit - Just asking opinion

Hi, Am trying to run zip -r on a 2.4G directory and it is failing with the error below. I believe this is because of the 2G limit of the zip program. server101(oper01)/u01/temp$: date Thu Mar 15 12:53:44 NZDT 2012 server101(oper01)/u01/temp$: ls -l total 8 drwxr-x--x 4 oracle dba ... (1 Reply)
Discussion started by: newbie_01
1 Replies

4. Shell Programming and Scripting

Untar specific directory and strip leading directories

Ok so I know the title was probably confusing so here goes: I have a tarball (gzipped) that has a nested directory structure . For example: my.tar.gz (contents) --- ------ --------- ------------ --------------- ... (2 Replies)
Discussion started by: DC Slick
2 Replies

5. Shell Programming and Scripting

cp, chown, untar

hello i want shell script. i have a source.txt /home/user409/public_html/test/ /home/user09876/public_html/xdsss/ /home/user9765/public_html/320xxx/ . . . maybe 1000 lines i want . 1.read a source.txt 2.untar special.tar.gz into these directory in source.txt 3.i want to... (14 Replies)
Discussion started by: topic32428285
14 Replies

6. AIX

untar

Hi, How can i untar a set of files in to different directory. This is content tar -tvf samba.tar drwxrwxrwx 0 0 0 Nov 28 18:35:41 2008 samba/ -rw-r--r-- 0 0 0 Nov 18 15:12:40 2008 samba/b.txt -rw-r--r-- 0 0 0 Nov 18 15:12:40 2008 samba/c.txt -rw-r--r-- 0... (4 Replies)
Discussion started by: allwin
4 Replies

7. Programming

Not able to use NFS mounted directory as buffer for untar & unzip.

Hi, For a new requirement, we are trying to use NFS mounted directory as the buffer (TMP_DIR) for untar. Target OS- VxWorks Host OS - Windows Embedded. mounted a directory in wondows onto VxWorks. During untar process of GNU we come across utime, for chaning the time stamp of the... (0 Replies)
Discussion started by: suraj.bc
0 Replies

8. UNIX for Dummies Questions & Answers

Untar problems

Hi, I am new to unix scripting. I have written a java program which will initialize a sftp connection and copy a unix script from my machine to a remote server. Then i initalized an ssh connection and i executed the script. This script contains a sequnece of commands and one of them is to... (2 Replies)
Discussion started by: vinothg
2 Replies

9. UNIX for Advanced & Expert Users

untar

i have try to untar the file in same location. But it gave the error # tar -xvf TSMSRVAIX5220.tar x tivoli.tsm.devices.acsls, 757760 bytes, 1480 media blocks. tar: 0511-169 A directory checksum error on media; 4011 not equal to 8222. How can i rectify this prob. Thanks in advance ... (2 Replies)
Discussion started by: prakash96453
2 Replies

10. UNIX for Dummies Questions & Answers

How can you UnTar files to a different directory?

Suppose you have a TAR file created with a different directory structure and you need to UnTar (or explode) the files to a different directory structure. How can this be done? If TAR command cannot do this, are there any other alternatives (any other command) available to UnTar a .Tar file? ... (1 Reply)
Discussion started by: joshivaibhav
1 Replies
Login or Register to Ask a Question