Rishi Arora
Rishi Arora

Reputation: 1793

How to tar a directory from different - different server and copy to current server on which I am working

Actually I want to tar a directory from different-different server and need to move that tar to my current server on which I am working so I am writing a shell script for that and had used the following command for this

ssh hostname " tar -cvj site1.tar.gz -C /www/logs/test " > site2.tar.gz

I had also tried moving it to a directory on my current server but not able to achieve that also, command tried -

ssh hostname " tar -cvj site1.tar.gz -C /www/logs/test " > /www/logs/automate

I tried this and think that it will not work, so is their any other way to achieve this, Please help. It will be appreciable. Thanks.

Upvotes: 0

Views: 73

Answers (1)

Cyrus
Cyrus

Reputation: 88636

With GNU tar:

ssh hostname "tar -C /www/logs/test -cjf -" > your.tar.bz2

-f -: write archive to stdout

Upvotes: 2

Related Questions