Skip to main content

Introduction to DownloadFiles and UploadFiles Tasks

Downloading and uploading files with a FTP/FTPS Tasks

R
Written by Riku Virtanen
Updated over a year ago

DownloadFiles and UploadFiles Tasks

DownloadFiles and UploadFiles Tasks are built to handle file transfers from and to a FTP server. The Tasks are made to resemble lot like the SFTP Tasks and have similar parameters. Only the connection parameter is different when comparing to the SFTP Tasks.

Source Properties

Source property includes Directory and a File name which will tell the Task where to get the source file and what file mask needs top be used to determine the correct file. Like with SFTP Task, FTP Tasks can handle multiple files during one transfer and for that the file name property can handle a filemask to be given which will be used to determine which files are to be transferred. Every file which is recognized by the mask is transferred. Regex and macros are also supported in the File name property.

Not found action is implemented to determine what actions needs to be taken when there are no files to be transferred in the source directory. Possible options are Error, which will affect the Task to throw an exception when source files are not found; Info, which will result in a successful execution with operations log and finally Ignore which will also result in a successful execution but without operations log.

Next option in the Source property is source operation. With this option you can determine what needs to be done to the source file after a successful transfer. Options for this are Delete, Rename, Move and Nothing. Pretty self explanatory but lets go through them nevertheless. With Delete Operation you can have the Task remove the file from the source directory after the transfer is completed. Rename option enables you to change the name of the source file, for example adding a transferred_ tag to the filename. Move operation moves the file to a set directory and Nothing operation will leave the source file intact.

Last option is File paths property. This property enables you to give the Task a ready made array which consists of file paths of the files to be transferred. The most use case for this property is File Trigger which has a property called filePaths. You can use the Trigger's filePaths property directly in the Task with a reference #trigger.data.filePaths.

Destination Properties

Task has three destination properties which include Directory for the destination, File name which can be left as empty if the filename will stay intact and Action which will determine an action if a file exists in the destination with a same name. Options for this Action property are: Error, which will cause the Task to throw an exeception; Overwrite, which will overwrite the content and attributes of the already existing file and Append, which will append the source file content to the existing file.

Options Property

Options property has multiple optional settings for the Task. First one is Throw error on fail: this will cause the Task to throw an exception when failure is met during the transfer.

Next options are renaming the source and destination files during the transfer. When these are enabled the source or destination files are renamed with random names and with an .8CO extension for the duration of the transfer. After transfer is completed both source and destination files are renamed back to original names. This feature enables the Task to lock the files for the duration of the transfer, so that another processes can't open the file during the transfer.

Next option is Create destination directories which like its name, will create the destination directories if they are not found from the destination side. In order to use this option you need to make sure that the agent's user has the necessary privileges on the local or the server side.

Preserve last modified options enables the Task to preserve the last modified timestamp on the file which was transferred.

Operation log options enables logging feature to be seen on the Task's result. Operation log is always enabled when an exception is thrown.

Info Properties

Info properties lists couple of optional settings for the Task. You can set a name for the transfer with the Transfer name property which will be shown in the error message if an exception is thrown.

Work dir property can be used to specify what directory will be used as the temporary location during the transfer. If this is left empty, the user's temp (%TEMP%) will be used.

Process uri and Task execution ID are used when the file is being renamed if those settings are enabled in the options properties.

Did this answer your question?