Skip to main content
Kofax

How to create a robot that will upload a file to a non-anonymous FTP directory or to an SFTP

Summary

13407

To upload a file to FTP / SFTP through a robot you have to use an Execute Command line step (and use and ftp /winscp command). The same logic in the steps below can be used to run other ftp /winscp commands.

Uploading to FTP

If the FTP directory requires a login, you need to use the -s option of the ftp command (to specify the text file containing the ftp commands).

Follow the steps below to create the robot:

  • create a text file with the following content (e.g. C:\Temp\FTPCommands.txt)

user
<YourUserNameHere>
<YourPasswordHere>
put <TheFileYouWantToUploadHere>
quit

  • in the robot, add an Execute Command Line step and set it to execute this line:

ftp -n -s:<theFileContainingtheFTPCommands> <YourFTPServerHere>

e.g. ftp -n -s:C:\Temp\FTPCommands.txt ftp.MyMachine.com

Uploading to SFTP

This example uses the winSCP command; more information: http://winscp.net/eng/docs/guide_automation

  • create a text file with the following content (e.g. C:\Temp\SFTPCommands.txt)

open sftp://user:password@example.com/ -hostkey="ssh-rsa 2048

xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"

put <TheFileYouWantToUploadHere>

  • In the robot, add an Execute Command Line step and set it to execute this line:

<PathTo>winscp.com /script=<theFileContainingtheFTPCommands> Note:

Note: This command can be saved to a script file and the robot could call this one specifically from the Execute Command Line step

Keywords: Kapow, Robotic Process Automation, FTP, SFTP

  • Was this article helpful?