FTP File Transfer with the Launch Application Robot
This topic provides a sample of using an expression in a Launch Application robot node to launch FTP and transfer a file from your server to another machine on the network.
Referenced Workflow
FTPApplicationRobotExample.xml
Description
The expression can be used in an Application robot node to launch FTP and run a text file containing the FTP commands to transfer a file from your server to another machine on the network. The two variables that must be declared for the workflow template containing this robot are: filename (the path and name of the text file containing ftp commands to run) and host (the host name or IP address of the remote host you want to access).
Instructions
The entire path for both the text file and the host must be specified in the respective variables. Note that the syntax for fileName is c:/Temp/. The forward slash makes the path platform independent.
1. Create a text file with the following contents: “Contents of FTPCommandFile.txt”.
2. Save the file in a directory called c:/Temp/FTPExample with the name FTPCommandFile.txt.
3. In the same directory, create an empty text file and save it as myText.txt.
4. In the workflow template containing the robot, create a variable called fileName with a value of c:/Temp/FTPExample/FTPCommandFile.txt.
5. Create a second variable called host.
6. Run the Application robot with the following code to open an FTP session with the specified host and transfer the myText.txt file from your server to the specified folder on the host machine.
Copy the following code:
ftp -i - d -s:{ fileName} { host}
Contents of FTPCommandFile.txt
Replace <yourUserID> and <yourPassword> with your ID and password for the host machine you are trying to access.
* 
This example is for informational purposes only. Storing passwords in plain text in an input file is a security risk. PTC recommends that you encrypt your passwords in a file or that you save any files containing a password in a secure location.
<yourUserID>
<yourPassword>
lcd c:/Temp/FTPExample1
Was this helpful?