how to write script in tar

i have the script.in this script comprees formatlike tar and insert to another directory and another sever.and how to write this process in script .
iam new for unix how to do this process.

please helpmea
naveen.g

As far as I do understand you, you want to write a script which does the following on the fly:
1) compress a directory like tar would
2) instead of writing the tar file to disk, you want to "stream" it to another server
3) there you want to unpack it

The following should do this:

(cd /source/dir && tar czf - .) | ssh login@server.tld "cd /target/dir/ && tar xzf -"