Topic "Writing a script in a batch file to fetch files from SSH"

Author Message
viki lingeria
[View user's profile]

Joined: 2005-07-25
Posts: 2
Hi ,

I am trying to write a script in a batch file to fetch the files from SSH server.

Have written the following code. But it does not seem to get the files from the server to my local machine.

Can you please tell me what could be going wrong?

Code:
# Automatically answer all prompts negativelly not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with previous
option confirm off
# Connect
open gstar:gstar@3.49.4.80
# Change remote directory
cd home/data/fs/gstar/25_07_2005
# Force binary mode transfer
# Download file to local directory d:\
get gstar_currency.xml d:\
# Disconnect
close
# Exit WinSCP
exit

Where : gstar is the username and the password.

Your assistance would be highly appreciated.

Regards

Viki Lingeria
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
viki lingeria wrote:
Have written the following code. But it does not seem to get the files from the server to my local machine.

And what does it do?
_________________
Martin Prikryl
Guest




prikryl wrote:
viki lingeria wrote:
Have written the following code. But it does not seem to get the files from the server to my local machine.

And what does it do?


I run the batch file & it gets executed with out any error. Pasting the output file here

C:\># Automatically answer all prompts negativelly not to stall

C:\># the script on errors

C:\>option batch on

C:\># Disable overwrite confirmations that conflict with previous

C:\>option confirm off

C:\># Connect

C:\>open gstar:gstar@3.49.4.80

C:\># Change remote directory

C:\>cd home/data/fs/gstar/25_07_2005

C:\># Force binary mode transfer

C:\># Download file to local directory d:\

C:\>get gstar_currency.xml d:\

C:\># Disconnect

C:\>close

C:\># Exit WinSCP

C:\>exit

Frankly I am not sure where is the script going wrong. Is something missing in the script.

Regards

Viki Lingeria
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
I have no idea what you are doing. You need to execute the script via WinSCP, not directly (or whatever you are doing)!
_________________
Martin Prikryl
viki lingeria
[View user's profile]

Joined: 2005-07-25
Posts: 2
prikryl wrote:
I have no idea what you are doing. You need to execute the script via WinSCP, not directly (or whatever you are doing)!


Hi Martin,

I am writing the script in a batch file. i.e. in a .bat file extenstion.

Do I have to write the script some where in WinSCP?

Kinldy reply. I am aware my question might have sound stupid. But I am new to WinSCP and I desperately need to transfer files from one server to another.

Please assist.

Regards

Viki Lingeria.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
viki lingeria wrote:
Do I have to write the script some where in WinSCP?

You need to pass it to WinSCP using /script parameter. Please read documentation .
_________________
Martin Prikryl
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