MSFN Forum: SSH Copy Script - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

SSH Copy Script with WinSC or Putty Rate Topic: -----

#1 User is offline   N1K 

  • MCSA W2K, MCDST
  • Group: Patrons
  • Posts: 1,431
  • Joined: 02-September 04

Posted 27 January 2008 - 07:59 AM

I need to make a script that will connect through SSH with Putty or WinSC application to a server which is in Germany.
Basically, one server is in Croatia and another is in Germany. When I make a connection between those two servers, I need to copy contents of one folder to Germany and vice versa.

What is the best way to do this using Putty or WinSC. A log would be also needed for this..

Thx


#2 User is offline   tguy 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 698
  • Joined: 19-May 04

Posted 25 April 2008 - 09:29 AM

Hi,

The first question that comes to mind is how often you will need to copy the files from one server to another. I am making a few assumptions here so bear with me. If I re-state things you already know please do not take offense as I am just trying to spell out my logic in how I would decide to administer this situation.

If you are doing frequent file copies I would suggest using a shell script that kicks off scp and copies the files for you. You can use the crontab functionality to execute the shell script. Conversely if you only need to copy the files a few times then WinSCP may be a better choice as it allows you to see the source and destination directories and to select multiple files at once to be copied even with different file extensions.

Secondly, if you are going to scp the files directly from the source server to the destination server you would want to do the following:

scp -v file.txt username@domain.com:/remote/directory >> var/log/scp.log

If you are copying the files from Croatia to Germany from your computer you would want to use Putty's pscp.exe to do the following:

scp -v username@domain.com:/remote/directory1/file.txt \ username@domain.com:/remote/directory2/ >> var/log/scp.log

Both these commands will execute the copies you need and will log the results to the file and directory listed above.

Hope this helps.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy