By sreekanth on May 13, 2009
Today I have to run some tests on various machines and have to post the results to a common directory in another machine.Since most of the machines are accessed through command line,I dont have any GUI to copy and paste.
Again making a zip file to the directory and then ftp it to target macine and then unzipping it , looked odd.So I googled out to find a simple way and found the below command to copy an entire directory in a single go:
tar -cf - <dir-to-be-copied> | ssh <user-name>@<target-machine> "cd target_dir; tar -xf -"
Now it asks for the user password and once you key in the password and hit enter, its done!!!
The above command copies the whole directory to the target machine. But this needs the machine has ssh setup on it.