Define a Post Transfer Action in Gateway Administrator

You can configure a Post Transfer Action to perform actions on files successfully uploaded to the Transfer Site server.

  • To add or edit Post Transfer Actions, you must be a member of a group with the Manage actions role enabled.

  • After an Action is created, it will run only on Transfer Sites that have added it as an action. To add an action to a Transfer Site, you must have the Manage transfer sites role enabled; you do not need the Manage actions role to add an existing action.

Before you begin

  • In Gateway Administrator's File Servers tab, set Transfer site file server to be an added SFTP server (not the default setting), and confirm that Transfer Sites can upload successfully to that server.

To define a Post Transfer Action

  1. Connect to Gateway Administrator.

  2. On the Actions tab, click New.

    • For Action name, specify a descriptive name to identify this action.

    • For Command, specify an executable command or the full path and name of an executable file on the Transfer Site file server followed by command arguments. After the command include any arguments to be passed to the specified program. Arguments can include supported tokens (enclosed in dollar signs). Tokens are replaced by actual values when the Action runs. Use spaces to separate multiple arguments.Use double quotation marks around any argument that might include spaces in the returned value.

      For examples, see the Sample Post Transfer Action Commands that follow.

  3. Click Save.

  4. Add this Action to one or more Transfer Sites.

NOTE:

  • If no path information is included, command output is created in the SSH login directory of the user whose UserID is configured for authentication in the server settings of the Transfer Site file server.

  • If full path information is included, the destination directory must exist, and the user account specified in the file server settings must be able to write to this directory.

Sample Post Transfer Action Commands

Use these examples as models for testing and configuring Post Transfer Actions. Samples include appropriate syntax for both Windows and UNIX SFTP servers.

Example 1: Save token values to a file in the upload directory

This example uses the operating system echo command to append the name of the uploaded file and the date of transfer to the contents of a file called tokenvalue.txt. (The file is created if it does not exist.) The token $FILE_PATH$ is used to create this file in the upload directory. Because this destination directory might include spaces, the token is enclosed in double quotation marks.

Windows SFTP server

cmd /c echo $FILENAME$: $DATE$ >> "$FILE_PATH$\tokenvalue.txt"

NOTE:On Windows servers, precede DOS commands with cmd /c. The /c switch is required; it specifies that cmd should exit after the specified command is carried out.

UNIX SFTP server

echo $FILENAME$: $DATE$ >> "$FILE_PATH$/tokenvalue.txt"

Example 2: Rename an uploaded file

This example renames the uploaded file by adding the name of the user who uploaded it to the filename. The $FULL_PATH$ token identifies the full path and name of the uploaded file.

Windows SFTP server

cmd /c rename "$FULL_PATH$" "$FILENAME$".$INITIATOR_USERID$

UNIX SFTP server

mv "$FULL_PATH$" "$FULL_PATH$".$INITIATOR_USERID$