Define a PTA in Gateway AdministratorYou can configure a Post Transfer Action (PTA) to perform actions on files successfully uploaded to a transfer site.
Before you begin
-OR-
To define a PTA
ExamplesUse 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 fileThis 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 serverProgram: 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 serverProgram: ls Arguments: -a -l "$FILE_PATH$" Example 2: Copy uploaded files to a specified directoryThis 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. To configure directory access on a Reflection for Secure IT server, add the required directories using the SFTP Directories pane. Windows SFTP serverProgram: cmd Arguments: /c copy "$FULL_PATH$" c:\fxgout UNIX SFTP serverProgram: cp Arguments: "$FULL_PATH$" /fxgout Example 3: Use a script to perform a sequence of actionsThis 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). To configure directory access on a Reflection for Secure IT server, add the required directories using the SFTP Directories pane. Windows SFTP serverThe 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:
UNIX SFTP serverThe 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$" Contents of demo.sh:
| ||||
|