TAR help

hi,

I know this command to create TAR for entire directory :

tar -cvf oracle_tar.tar /opt/oracle/10.2

so it will create tar file for /opt/oracle/10.2 directory

I am looking for command to create TAR file with the contents of 10.2 directory only , so that when I extract I can extract into any directory .

Thanks

Hi.

Perhaps you could cd into /opt/oracle first, and then:

tar cvf oracle_tar.tar 10.2

Go to wherever ". (dot)" is, and extract it.

Using tar with an absolute path will cause it to extract as such. Use relative paths with TAR, as a general rule of thumb (i.e. when not writing to a tape).

Thanks Scott!!

what if I want to include just the contents of 10.2 , with out the directory.

Thanks

tar cvf oracle_tar.tar -C /opt/oracle/10.2 .