# Transfer Using Templates

You can perform file transfers by defining all required transfer parameters and options in transfer templates.

Using templates is a method to save your time. After creating a template, specify the Template | t parameter in the cfsend or cfrecv command.

The format for using a template is as follows:

- `cfsend t:TemplateFileName`
- `cfrecv t:TemplateFileName`

Two sample templates called TSEND and TRECV are installed and located in the $CFROOT directory by default. For more details of the sample templates, see Sample Templates: TSEND and TRECV.

In a template, by specifying the TransferType (trtype) parameter, you can perform the following types of transfers:

- You can simply send or receive a file. To perform such transfers, specify the TransferType | trtype parameter as F; or you do not have to set the TransferType parameter because this is the default transfer type.
- You can send or receive an executable file, and run the file as a job. To perform such transfers, set the TransferType | trtype parameter as J.
  Note: The LocalFileName and the RemoteFileName parameter in the template are to define the name of the executable file.
- You can send a command, and run it in a remote system. To perform such transfers, set the TransferType | trtype parameter as C.
  Note: If the remote system is Windows or UNIX, the LocalFileName parameter in the template is to define the name of the file to place command output. The RemoteCommand parameter is to define the command you want to use in the remote system.
- You can send a file, and run it as a print job. To perform such transfers, set the TransferType | trtype parameter as P.
  Note: The LocalFileName parameter is to define name of the file to print. The RemoteFileName parameter is to define the printer name on the remote system.

When using the cfsend or cfrecv command with a template, you can also specify other transfer parameters on the command line. The parameters specified on a command line take higher precedence over parameters specified in a template.

See the following examples for your reference:

- `cfsend t:TSEND ip:10.1.1.130`

  In this example, the file defined in TSEND is the file sent to a file to the IP address 10.1.1.130, even if another IP address has been defined in the TSEND template.

- `cfsend t:TSEND n:dataServerB`

  In this example, the file defined in TSEND are sent to the dataServerB node, even if another node has been defined in TSEND template.
  Note: If you specify both a node and a template on a command line, the parameters specified in a node can override parameters specified in a template. As an exception, the IpName/Address and Port parameters specified in a template can override the HostName|h and Port|p parameters specified in a node. Therefore under this circumstance, it is good practice to mark the IpName/Address and Port parameters as comments in the template.

Copyright © 2022. TIBCO Software Inc. All Rights Reserved.