Frends.FTP.UploadFiles / 2.0.0
Summary
Transfers local files to an FTP or FTPS server, deciding per file what happens to the source afterwards and how to handle a name already in use at the target.
Typical use — scheduled delivery to a partner, where renaming after transfer signals completeness to the receiving side
Remarks
Transfer overview
The file transfer progress has the following steps:
Initialize
Initializes the transfer and opens the source connection.
ListFiles
Get a list of files from the source endpoint according to the filename/mask. If there are no files to transfer, the source connections are closed, and the transfer finishes. The result of the task will then depend on what the option
NoSourceActionwas set to. If it was set to Error, either the #result.Success property will be set to false, or if the `ThrowErrorTransfer files
If there are files to transfer, they are then transferred individually. For every file in the list returned from the source endpoint, the following process is repeated:GetFile
Get a file from the source endpoint to the local work directory. If the parameter
RenameSourceFileBeforeTransferis set totrue, the file is first renamed with a temporary filename before transfer.Rename or move the source file.
This is done before transferring the file to the destination, this means that possible errors in the renaming or moving that would cause the transfer to fail will happen as early as possible - before we actually try to transfer files onward.
Transfer the file.
If destination file already exists, depending on the parameter
DestinationFileExistsActioneither an exception is thrown, the destination file is overwritten or the source file is appended to the destination file.
If the parameterRenameDestinationFileDuringTransferistrue, the file is first transferred with a temporary file name and afterwards renamed to intended filename, otherwise the file is transferred with the intended filename. The intended filename has its possible file masks expanded.Do the source file operation.
Perform the operation defined by the
SourceOperation.
Finish
Close the source and destination endpoint connections.
If the transfer is cancelled (e.g. by calling Terminate on the process instance), the files that are currently being transferred will be processed until finished, but no new files will be transferred. The cancelled transfer end result will be Failed.
Macro reference
Macros can be used to dynamically configure source directory, destination directory or destination file name for a file transfer.
Generally the following rules apply for macros:
- Macros are case insensitive.
- You can use any number of macros in all of the cases.
- Dates and times are formatted with leading zeros.
The following macros can be used with all of dynamically configurable locations for file transfer:
- %Ticks% = will be replace with the current time as Ticks.
- %DateTime% = will be replaced with date and time in format: "yyyy-MM-dd-HH-mm-ss".
- %DateTimeMs% = will be replace with date and time in format: "yyyy-MM-dd-HH-mm-ss-fff".
- %Date% = will be replaced with date in format: "yyyy-MM-dd".
- %Time% = will be replaced with time in format: "HH-mm-ss".
- %Year% = will be replaced with current year.
- %Month% = will be replaced with current month.
- %Day% = will be replaced with current day.
- %Hour% = will be replaced with current hour.
- %Minute% = will be replaced with current minute.
- %Second% = will be replaced with current second.
- %Millisecond% = will be replaced with current millisecond.
- %WeekDay% = will be replaced with a number of weekday, ranging from 1 (monday) to 7 (sunday).
- %Guid% = will be replaced with a new unique identifier.
- %TransferId% = will be replaced with the transfer id.
- %TransferName% = will be replaced with TransferName parameter specified in Connection point schema.
- %TransferGroupName% = will be replaced with TransferGroupName parameter specified in routine's task arguments.
Destination file name has two additional macros that can be used for dynamically creating destination file name.
- %SourceFileName% = will be replaced with source file name without extension.
- %SourceFileExtension% = will be replaced with source file's extension, with the dot '.' included, i.e. if the source file is named 'foo.txt', the %SourceFileExtension% will be expanded as '.txt'. If the source file name does not have an extension, the macro result will be empty, i.e. for original file name "foo", "bar%SourceFileExtension%" will result in "bar"
- Upgraded the Task to target .NET 8.
- Breaking The
Source,DestinationandInfoparameters are now grouped under a singleInputtab. - Breaking Renamed the
ThrowErrorOnFailoption toThrowErrorOnFailure. - When
ThrowErrorOnFailureis disabled, any error is now returned in the newErrorproperty of the result instead of being thrown.
- Added the
ErrorMessageOnFailureoption for defining a custom error message. - Added the
Errorproperty to the result.
- Fixed issue with Task not throwing even when retry failed.
- Added check for file checksum and size.
- Added retry attempts parameter to retry the transfer if checksum or file size differs.
- Added setup for FtpClient.ReadTimeout, FtpClient.DataConnectionConnectTimeout and FtpClient.DataConnectionReadTimeout which were all defaulting to 15 seconds.
- Added search for local certificates from machine certification store.
- Breaking Added parameters ClientCertificationName and ClientCertificationThumbprint for exclusive search of client certification.
- Operations log improvements.
- Connection.BufferSize documentation update. Value is set as bytes instead of KBs.
- Removed Connection.ClientCertificatePath's default value.
- Updated Task's return fields documentation.
- Initial implementation