Automation to move the files from one ssh to another ssh

Advertisement

ramkumarluv
Joined:
Posts:
1

Automation to move the files from one ssh to another ssh

Hi Team,

I have a requirement where I need to move the files from one server to another server

SERVER1 - Source
Files in a folder
/example/Sample107-20-21 12:34:34.dat.gz
/example/Sample207-20-21 12:43:34.dat.gz
/example/Sample207-20-21 12:53:34.dat.gz
/example/Sample207-20-21 12:53:34.dat.gz
/sample/Test1.txt
/sample/Test2.txt

If we above the above list of files some of the files are timestamped with date and time
and the /sample/Test1.txt and Test2, txt files are without timestamp. The timestamped files are gz need to be unzipped and renamed to Sample1.dat

So I would like to read all files daily from the above folder and copy them into a different server

SERVER2 - Destination
//destination/Sample1.dat
//destination/Sample2.dat
//destination/Sample3.dat
//destination/Test1.txt
//destination/Test1.txt

Can you please help me to prepare an automation script using WinSCP and complete this task.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Re: Automation to move the files from one ssh to another ssh

So are these two remote servers? You cannot use SFTP/SCP client on a local machine to move files between two remote servers. All you can do is to download the files from the first server and upload them to the second server. If you want to move files directly, you would have to run the client on one of the servers to upload to or download from the other one. That's not a job for (Windows) WinSCP.

Reply with quote

Guest

I am already using SCP command from one remote server to another remote server. I want to automate using the script without any labor work

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Do you mean that you use scp tool in this form?
scp sourceserver:/source/path targetserver:/target/path
That actually does what I wrote above: "run the client on one of the servers to upload to ... the other one".
It connects with SSH to sourceserver and there it runs:
scp /source/path targetserver:/target/path
(or maybe the other way around, I'm not sure now)
That's not something WinsCP is designed for. If you already use scp for this, why don't you keep using it?

Reply with quote

Advertisement

You can post new topics in this forum