1819827 Members
3067 Online
109607 Solutions
New Discussion юеВ

Tar a directory

 
SOLVED
Go to solution
Clint Gibler
Frequent Advisor

Tar a directory

I have a directory on an HPUX 10.20 system I need to ftp to another system I was going to tar or gzip it and ftp it as one file, my question is which is better and what is the command I use to tar the directory or gzip the directory?
5 REPLIES 5
Pete Randall
Outstanding Contributor
Solution

Re: Tar a directory

I would suggest tar. There's a good example in the man page:

Archive all files and directories in directory my_project in the current directory to a file called my_project.TAR, also in the current directory:

tar -cvf my_project.TAR my_project

Then you can just ftp my_project.TAR and extract with tar -xvf.


Pete

Pete
Paul Sperry
Honored Contributor

Re: Tar a directory

I would do both.

tar -cvf dir.tar /path/dir

then

gzip dir.tar

then ftp the dir.tar.gz file

then on the other system

gunxip dir.tar.gz

and

tar -xvf dir.tar
Patrick Wallek
Honored Contributor

Re: Tar a directory

And to add to Pete's response:

If you then want to gzip the myproject.TAR file to hopefully make the FTP even faster:

# gzip myproject.TAR

Then you FTP myproject.TAR.gz to your remote machine and;

# cd /somedir
# gunzip myproject.TAR.gz
# tar -xvf myproject.TAR
Senthil Kumar .A_1
Honored Contributor

Re: Tar a directory

hi,

Pete is spot on with the answer, anyway if resulting ".tar" turn's out to be huge one,u could perform compression aswell on the tar file before ftp'ing...

just do this after tar'ing..

gzip my_project.TAR

this will create a compressed file : my_project.TAR.gz

After ftp'ing to the target machine..uncompress it before extracting with "tar -xvf"..

gunzip my_project.TAR.gz

regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Senthil Kumar .A_1
Honored Contributor

Re: Tar a directory

Sorry guy's.. for having given the same solution, Honestly, I was typing my answer and not notice that others were working on it...


I guess, a environment like "HP service desk" application would have reduced the conflicts with time ... ;) Just kidding...
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)