Operating System - HP-UX
1833461 Members
3075 Online
110052 Solutions
New Discussion

Simple Question About Tar

 
SOLVED
Go to solution
Andrew Kaplan
Super Advisor

Simple Question About Tar

I'm almost too embarrased to ask this:

What is the correct syntax if I want to tar the contents of the directory, subdirectories and all, that I am currently in and create the tar file in another directory?
A Journey In The Quest Of Knowledge
6 REPLIES 6
Michael Schulte zur Sur
Honored Contributor
Solution

Re: Simple Question About Tar

Hi Andrew,

that would be

tar cvf /path/to/archive .

Michael
Patrick Wallek
Honored Contributor

Re: Simple Question About Tar


# tar -cvf /destination/dir/tarfile_name.tar .

Note the space between the tarfile_name.tar and the last .

The last . tells tar to take everything in the current directory.
Graham Cameron_1
Honored Contributor

Re: Simple Question About Tar

tar cvf PATHTOYOURTARFILE .
eg
tar cvf /tmp/my.tar .

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Robert-Jan Goossens
Honored Contributor

Re: Simple Question About Tar

Hi,

# tar -cvf /dir/test.tar .

Regards,

Robert-Jan.
Andrew Kaplan
Super Advisor

Re: Simple Question About Tar

Thanks guys...Sorry to bother you about this.
A Journey In The Quest Of Knowledge
Michael Schulte zur Sur
Honored Contributor

Re: Simple Question About Tar

Hi Andrew,

not for this. Thanks for the ten points!!

Michael