1833490 Members
2807 Online
110052 Solutions
New Discussion

tar question

 
SOLVED
Go to solution
simon peter wickham_1
Occasional Contributor

tar question

Hi

I have a directory with many log files I need to send someone. These are in /var/adm/Log_Files and I have cd /var/adm.

What I want to do is tar this directory up from /var/adm how do I go about this.
Is the command tar -cvf /var/adm/Log_Files log.tar

Thanks
Simon
4 REPLIES 4
Sundar_7
Honored Contributor
Solution

Re: tar question

Simon,

Nope the above syntax wont work for you

tar -cvf log.tar /var/adm/Log_Files

-- Sundar.
Learn What to do ,How to do and more importantly When to do ?
Sridhar Bhaskarla
Honored Contributor

Re: tar question

Hi Simon,

If you want to tar it up with absolute path name, then it would be

tar cvf log.tar /var/adm/Log_files

Ensure you have enough space in the current directory (it can be anything). When you untar it, it will create a directory /var/adm/Log_files (if it doesn't exist) and restore the files.

If you want the relative path, then

cd /var/adm
tar cvf log.tar Log_files

When you untar it, it will create Log_files directory (if it doesn't exist) in the current directory and untar the files.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
melvyn burnard
Honored Contributor

Re: tar question

no, you have the definitions the wrong way around
It should be:
tar -cvf log.tar /var/adm/Log_Files
However, this means that whoever extracts these files is forced to put them back in the same directory structure.
why not do:
cd /var/adm/Log_Files
tar cvf /tmp/log.tar *

My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
simon peter wickham_1
Occasional Contributor

Re: tar question

Thanks for the help.