Tuesday, November 1, 2016

File Transfer With On-the-fly Compression

I want to copy a folder from 1 server to another server with smart way.
1. Because not enough space to extract in current server. 
2. To transfer big files with minimal time.

Here is the command; 
Run this at "server source" 
tar czf - /path/to/copy/folder | ssh shariha@serverdestination tar xzf - -C /path/to/place

eg:  
server source: 10.10.10.10 : want to copy folder /data/folder1
server destination: 10.10.10.11 : want to place it at  /data/migrate/

run at 10.10.10.10
tar czf - /data/folder1 | ssh shariha@10.10.10.11 tar xzf - -C /data/migrate/

ps: this will tar the folder and untar directly to the path that we want to place it. :) 

Nice :) 



No comments:

Post a Comment