Local environment overrides for the remote server on the FileOutput node
Set values in the local environment to override the location of the remote server specified on the FileOutput node. You can also use the local environment to specify commands to run before or after FTP or SFTP transfers.
Remote server location
You can set the location of the FTP or SFTP server for the FileOutput node to use in LocalEnvironment.Destination.File.Remote.Server. If this field is present in the local environment, it overrides the Remote server and port property on the FileOutput node. Set this local environment field to the name of a configurable service, the name of a server, or a server name and port number.
Commands used before or after file transfer
You can also use the local environment to specify commands to run before or after an FTP or SFTP transfer finishes.
LocalEnvironment/Destination/File/Remote/Precommand
This
field can be repeated for each pre-transfer command that is required.
The commands are run in the index order of the field (for example,
Precommand[1] is run before Precommand[2]). If two commands exist
under any one Precommand field, an error is issued. LocalEnvironment/Destination/File/Remote/Postcommand
This
field can be repeated for each post-transfer command that is required.
The commands are run in the index order of the field (for example,
Postcommand[1] is run before Postcommand[2]). If two commands exist
under any one Precommand field, an error is issued. If the post command
fails, the file transfer is not rolled back. LocalEnvironment/Destination/File/Remote/Postcommand[1]/IgnoreErrors = true;
LocalEnvironment/Destination/File/Remote/Postcommand[1]/MKDIR = 'NOTTHERE';
For
each command to be run on the server, you can use the values shown
in the following tables as fields in the local environment. These
commands are not case sensitive.Field name | Parameters | Usage |
---|---|---|
RENAME | From, To | Use this command to rename a file specified in the From field to the file name specified in the To field. |
DELETE | Value of field | Use this command to delete the file specified in the DELETE field. |
MKDIR | Value of field | Use this command to make the directory specified in the MKDIR field. |
RMDIR | Value of field | Use this command to delete the directory specified in the RMDIR field. |
CD | Value of field | Use this command to change the current directory to the directory specified in the CD field. |
CDUP | No Parameters | Use this command to change the current directory to the parent directory. |
Field name | Parameters | Usage |
---|---|---|
SITE | Value of field | Use this command to run a SITE FTP command. The value of the SITE field contains the full string to run, including parameters or options. |
QUOTE | Value of field | Use this command to run a raw FTP server command.
The value of the QUOTE field is the command,
including parameters to run. This command does not check that the attempted action is compatible with how the transfer works in the file node. Therefore, do not attempt to transfer data, or receive data, by using the quote mechanism; for example, do not use STOR, APPE, or RETR. |
-- select the remote server
set OutputLocalEnvironment.Destination.File.Remote.Server = 'cs' || cast(I as char);
-- make a new directory on the server
set OutputLocalEnvironment.Destination.File.Remote.Precommand[1].MKDIR = 'T4';
-- change directory into the new directory
set OutputLocalEnvironment.Destination.File.Remote.Precommand[2].CD = 'T4';
-- set the name to which to transfer the file
set OutputLocalEnvironment.Destination.File.Name = 'cs' || cast(I as char);
-- after the transfer, rename the file to a new name in the directory
set OutputLocalEnvironment.Destination.File.Remote.Postcommand[1].RENAME.From = 'cs' || cast(I as char);
set OutputLocalEnvironment.Destination.File.Remote.Postcommand[1].RENAME.To = '../ds' || cast(I as char);
-- change the directory to the parent directory
set OutputLocalEnvironment.Destination.File.Remote.Postcommand[2].CDUP = '';
-- delete the directory that was created previously
set OutputLocalEnvironment.Destination.File.Remote.Postcommand[3].RMDIR = 'T4';
propagate;