In this scenario, a six-component Job checks if a defined file exists in a specified directory on a remote SCP server, and returns a message to indicate the result of the verification. If the file doesn't exist in that directory, the Job will put the local file to the SCP server, and then get the file from the SCP server to another defined local directory to verify that the file has been uploaded correctly.
Add the following six components by typing their names on the design workspace or dropping them from the Palette to the design workspace: tSCPConnection, tSCPFileExists, tJava, tSCPPut, tSCPGet, and tSCPClose.
Connect the tSCPConnection component to the tSCPFileExists component using a Trigger > On Subjob Ok connection.
Connect the tSCPFileExists component to the tJava component using a Trigger > On Component Ok connection, and to the tSCPPut component using a Trigger > Run if connection.
Connect the tSCPPut component to the tSCPGet component using a Trigger > On Subjob Ok connection.
Connect the tSCPGet component to the tSCPClose component using a Trigger > On Subjob Ok connection.
Double-click the tSCPConnection component to open its Basic settings view.
Enter the host name or IP address of the SCP server and the port number in the corresponding field.
Enter the user name used for connection in the Username field.
Select Password from the Authentication method drop-down list.
Click the [...] button next to the Password text box, then in the pop-up [Enter a new password] dialog box, enter the password between double quotes and click OK to save the change.
Double-click the tSCPFileExists component to open its Basic settings view.
Select the Use an existing connection check box and then select the connection you have configured from the Component List.
In the Filename field, enter the name of the file to be checked between double quotes. In this example, it is "testscp.txt".
Double-click the tJava component to open its Basic settings view.
In the Code field, enter the following code:
Select the Component tab and click the If connection to open its Basic settings view.
In the Condition field, enter the following code:
This way, if the file doesn't exist in the defined directory, the rest of the Job will be executed.