Topic "Script to retrieve files from multiple computers"

Author Message
edslead

Guest


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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
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:
http://winscp.net/eng/docs/scripting#syntax

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

Please read documentation:
http://winscp.net/eng/docs/scripting#hostkey
_________________
Martin Prikryl
tsantony
[View user's profile]
Donor
Joined: 2013-01-04
Posts: 12
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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
tsantony wrote:
this antony here, sorry i'm also facing the same issue. did you find the answer for your question?

Duplicate post:
http://winscp.net/forum/viewtopic.php?p=43558#43558
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License