Script to retrieve files from multiple computers

Advertisement

edslead
Guest

Script to retrieve files from multiple computers

I am new to this and have a simple script working, but I would like the script to run for X number of times for different computers.

What I have so far is...

# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
open sftp://user:password@10.104.65.234
# Change remote directory
cd /EXTRADisk/CHMCS/apps/receivers/logs
# Force binary mode transfer
option transfer binary
# Download file to the local directory
get 15032012.log C:\WinSCP\FILES\10.104.65.234.log
# Disconnect
close
# Exit WinSCP
exit

What I want to do is run this X number of times for each IP I have and store the retrieved file with the same IP designation.

Also, if I try to retrive a file from a computer that needs to exchange keys, I get...

confirm off
Searching for host...
Connecting to host...
Authenticating...
The server's host key was not found in the cache. You have no guarantee that the
server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 0e:3c:df:fd:e9:f6:ef:56:e0:ca:43:a5:d2:bb:97:44
If you trust this host, press Yes. To connect without adding host key to the cac
he, press No. To abandon the connection press Cancel.
Continue connecting and add host key to the cache?
(Y)es, (N)o, C(a)ncel, (C)opy Key:

...so how can I make sure that option 'Y' is activated if this entry is needed.

Thanks.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,271
Location:
Prague, Czechia

Re: Script to retrieve files from multiple computers

edslead wrote:

What I want to do is run this X number of times for each IP I have and store the retrieved file with the same IP designation.
You can use script arguments for this:
https://winscp.net/eng/docs/scripting#syntax

...so how can I make sure that option 'Y' is activated if this entry is needed.
Please read documentation:
https://winscp.net/eng/docs/scripting#hostkey
_________________
Martin Prikryl

Reply with quote

tsantony
Donor
Joined:
Posts:
12

Re: Script to retrieve files from multiple computers

Hi,

this antony here, sorry i'm also facing the same issue. did you find the answer for your question?
please help me.

Regards
Antony.

edslead wrote:

I am new to this and have a simple script working, but I would like the script to run for X number of times for different computers.

What I have so far is...

# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
open sftp://user:password@10.104.65.234
# Change remote directory
cd /EXTRADisk/CHMCS/apps/receivers/logs
# Force binary mode transfer
option transfer binary
# Download file to the local directory
get 15032012.log C:\WinSCP\FILES\10.104.65.234.log
# Disconnect
close
# Exit WinSCP
exit

What I want to do is run this X number of times for each IP I have and store the retrieved file with the same IP designation.

Also, if I try to retrive a file from a computer that needs to exchange keys, I get...

confirm off
Searching for host...
Connecting to host...
Authenticating...
The server's host key was not found in the cache. You have no guarantee that the
server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 0e:3c:df:fd:e9:f6:ef:56:e0:ca:43:a5:d2:bb:97:44
If you trust this host, press Yes. To connect without adding host key to the cac
he, press No. To abandon the connection press Cancel.
Continue connecting and add host key to the cache?
(Y)es, (N)o, C(a)ncel, (C)opy Key:

...so how can I make sure that option 'Y' is activated if this entry is needed.

Thanks.

Reply with quote

Advertisement

You can post new topics in this forum