Define a PTA in Gateway Administrator

You can configure a Post Transfer Action (PTA) to perform actions on files successfully uploaded to a transfer site.

  • To add or edit PTAs, you must be a member of a group with the Manage actions role enabled.
  • After a PTA 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 Storage tab, configure an SFTP server and confirm that transfer sites can upload successfully to that server.

-OR-

To define a PTA

  1. Connect to the FileXpress Gateway Administrator.
  2. On the Actions tab, click New.
    • For Action name, specify a descriptive name to identify this action.
    • For Program, specify an executable command or the full path and name of an executable file on the file storage server. Some examples are provided below.
    • (Optional) For Arguments, enter one or more arguments to be passed to the specified program. Arguments can include supported tokens. Tokens are replaced by actual values when the PTA runs.
  3. Click Save.

Examples

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

Example 1: Send a directory listing to the log file

This example uses a system command to send a directory listing to the Gateway Administrator log file. The $FILE_PATH$ token is used to get the listing for the upload directory. Because the destination directory might include spaces, this token is enclosed in double quotation marks.

Windows SFTP server

Program: cmd

Arguments: /c dir "$FILE_PATH$"

Note: Use the /c argument when you use the Windows cmd command. This switch specifies that cmd should exit after the specified command is carried out.

UNIX SFTP server

Program: ls

Arguments: -a -l "$FILE_PATH$"

Example 2: Copy uploaded files to a specified directory

This example uses a system command to copy uploaded files to an existing destination directory.

Note: The destination directory (fxgout in these examples) must exist, and the user account specified in the File Storage configuration must be able to write to this directory.

Windows SFTP server

Program: cmd

Arguments: /c copy "$FULL_PATH$" c:\fxgout

UNIX SFTP server

Program: cp

Arguments: "$FULL_PATH$" /fxgout

Example 3: Use a script to perform a sequence of actions

This example uses a script to write information about the transfer to a file, and then move the file to a specified directory. File tokens are passed to the script as command line arguments. Because the returned values of these tokens can include spaces and special characters, the arguments are enclosed in double quotes.

Note: The user account specified in the File Storage configuration must have sufficient rights to run the script and write to the output directories (fxgpta and fxgout in these examples).

Windows SFTP server

The PTA runs the script demo.bat, which adds information about each transferred file to the filelist.txt file, then moves the uploaded files to c:\fxgout.

Program: c:\fxgpta\demo.bat

Arguments: "$FILENAME$" "$TIME$" "$INITIATOR_USERID$" "$FULL_PATH$"

Contents of demo.bat:

 
echo Filename:      %1 >> c:\fxgpta\filelist.txt
echo Transfer Time: %2 >> c:\fxgpta\filelist.txt
echo User ID:       %3 >> c:\fxgpta\filelist.txt
echo ================= >> c:\fxgpta\filelist.txt
move %4 c:\fxgout
 

UNIX SFTP server

The PTA runs the script demo.sh, which adds information about each transferred file to the filelist file, then moves the uploaded files to /fxgout.

Program: /fxgpta/demo.sh

Arguments: "$FILENAME$" "$TIME$" "$INITIATOR_USERID$" "$FULL_PATH$"

Note: A common error is to forget to set execute permissions on the script file using chmod. For this example execute permissions were set using: chmod +x demo.sh.

Contents of demo.sh:

 
echo Filename:      $1 >> /fxgpta/filelist.txt
echo Transfer Time: $2 >> /fxgpta/filelist.txt
echo User ID:       $3 >> /fxgpta/filelist.txt
echo ================= >> /fxgpta/filelist.txt
move $4 /fxgout
 

Related Topics

Post Transfer Action Tokens

Configure PTAs in Gateway Administrator

Configure PTAs in Reflection for Secure IT

Post Transfer Action Troubleshooting

Next

Add a PTA to a Transfer Site