Topic "Capability"

Author Message
rhnielsen

Guest


I was looking through the documentation and not sure I can accomplish what I need. I would like to ask a simple question if possible. I'm no expert on FTP or scripting, but not afraid to do the work to make it work. Before I go down that route can someone confirm that I can accomplish the following.........

I want to put a command line at the top of a batch job that confirms that the receiving FTP server is online and functioning. I'm thinking I would write a login script and if it does not work WinSCP would return some type of error code which the batch job can look for. If the error exists the batch job would exit and not try to send the data file.

Can this be done using WinSCP?

Thank you
Advertisements
Pathduck
[View user's profile]
Donor
Joined: 2012-05-29
Posts: 76
Location: Oslo
Hi!

'winscp.com' is the thing to use for scripting, read the docs here:
https://winscp.net/eng/docs/scripting

Open a connection and exit:
Code:
winscp.com /command "open ftp://anonymous:password@ftp.scene.org/" "exit"


Then check return code of last command:
Code:
echo %errorlevel%
0


So if it doesn't work or server is down:

Code:
winscp.com /command "open ftp://anonymous:email@domain.com@ftp.scene.org:1234/" "exit"
Connecting to ftp.scene.org:1234 ...
Connection failed.
No connection could be made because the target machine actively refused it.
Connection failed.

echo %errorlevel%
1
Guest




Thank you. I'll look through the documentation and do some testing. I appreciate the help very much.
Guest




I downloaded the program and tested it with your command and it worked perfectly! Thank you so much! I'll make a PayPal donation to the cause.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26456
Location: Prague, Czechia
Sure. Start here:
https://winscp.net/eng/docs/guide_automation#results
Advertisements

You can post new topics in this forum






Search

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