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
Page 1 of 1
SSH Copy Script with WinSC or Putty
#2
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.
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.
- ← What language is used by most software developers?
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- DirectX9 →
Share this topic:
Page 1 of 1



Help
Back to top









