Bash Tarring not un Tarring correctly

HI All,

Im encountering behaviour that is not correct for my requirements when I untar a file.

Im using the below command to tar up files from various folders to the ARCHIVE folder as below...

tar -cvf "$ARCHIVE_PATH"/"$dte_tar_filename" "$LOG_PATH" "$PROCESSED_PATH2" "$ERROR_PATH"

WHen I copy the tarred file into a seperate independent folder and use
tar -xvf *.tar , the files are untarred into the above folder respectively which I do not want. (Note the variables I pass into the tar command manitain the full path structure)

I just want all the folder structure and files to untar within the independent folder where I issued the command tar -xvf *.tar.

I missing a trick here.. any ideas?

Regards
Satnam

I doubt we have that option...
I tried but could not get anything in the man page.
one alternative is to to read thru' the tar file and get things done by removing the header/trailer.. Not a good idea though

See if this helps you,

tar -C <DIR> -xvf *.tar

HI, Unfortunatelt tar -C <DIR> -xvf *.tar
did not seem to work , Im working on Solaris using Bash So Im not sure of that a factor.

The weird thing is that when I use Cygwin Bash on windows, it opens up the tar file and cretes the folder structure within the folder the tar file was in which is exactly what I need. ie id does not place the files in the origional folders as is the problem explained in my origional posting.

Any further ideas appreciated?!

Regards
Satnam

hmm.. I just gave the option but not the proper syntax..

try, tar -xvf xxx.tar -C <DIR>

it should work..

Nothing todo with shell, only your version of tar is important.

Solaris tar man

In some tar you can use A option for this:
tar -xvAf xxx.tar will restore using THIS directory with relative paths even tar has done using absoluth paths.
I looked one Solaris (5.10) man tar, I didn't find any options for this ...

My opinion has been always - make tar using relative paths. Easier to handle restore.

Solution: move tar file to some Linux box and use -C option or install gnutar for your SunOS and use -C option.

---------- Post updated at 11:16 AM ---------- Previous update was at 11:16 AM ----------

Nothing todo with shell, only your version of tar is important.

Solaris tar man

In some tar you can use A option for this:
tar -xvAf xxx.tar will restore using THIS directory with relative paths even tar has done using absoluth paths.
I looked one Solaris (5.10) man tar, I didn't find any options for this ...

My opinion has been always - make tar using relative paths. Easier to handle restore.

Solution: move tar file to some Linux box and use -C option or install gnutar for your SunOS and use -C option.