File archiving#
SFTPPlus can keep an archive copy of transferred files in addition to delivering them to the destination. Successful transfers can be archived on the source location, on the local filesystem, or on another remote location. Set archive_location_uuid to the UUID of the location where you want to keep the archive, and set archive_success_path to a folder on that location. To archive on the source location, use the same UUID as source_uuid. The archive location must support writing files and listing folders.
Use an archive folder outside the monitored source path to avoid transferring archived copies again. For example, a transfer reading /incoming can archive successful files in /archive/success on the same location.
Failed transfers can also be archived using archive_failure_path. This is supported only for local source files, and failed files are always archived on the local filesystem.
SFTPPlus preserves the source directory structure within the archive. By default, it adds timestamps to file names to avoid overwriting earlier copies. Archiving copies the source file again and applies the configured content conversion. It does not create a compressed archive such as a ZIP file.
Automatic cleanup can delete old files from the success and failure archive folders. Set archive_retention_period to the number of days to keep files, or leave it at 0 to keep them indefinitely. Cleanup applies to all files in these folders and their subfolders, including files not created by SFTPPlus, based on each file's modification time. It leaves directories in place. The archive location must support file deletion when retention is enabled.
For other transfer settings, see the transfers configuration reference.
Archiving on the source location#
The following settings archive successful transfers on the source location and automatically delete archive files older than 30 days:
source_uuid = 5f304286-8d56-41f9-ba57-420a2303e90c
source_path = /incoming
archive_location_uuid = 5f304286-8d56-41f9-ba57-420a2303e90c
archive_success_path = /archive/success
archive_retention_period = 30
To use a separate remote archive, set archive_location_uuid to that location's UUID. The archive_success_path is interpreted on the selected archive location.
archive_location_uuid#
- Default value:
DEFAULT-LOCAL-FILESYSTEM
- Optional:
Yes
- From version:
5.17.0
- Values:
UUID of a location that supports writing files and listing folders
Empty
- Description:
Location used to store files archived after successful transfers. Failure archives always use the local filesystem.
When left empty, it will use the default local filesystem.
archive_success_path#
- Default value:
Empty
- Optional:
Yes
- From version:
3.0.0
- Values:
Path.
Empty
- Description:
Path to a folder used to keep a copy of successfully transferred files.
The configured path is based on the location configured via archive_location_uuid.
The archiving is done by transferring the source file again to the archive location. The file is archived with the same content as the one used to transfer to the destination. The archived content might differ from the source content when the transfer is configured with content transformations.
Note
The archiving is not done using the move operation as many servers don't support the rename/move operation. For example, cloud-native storage protocols like Azure BLOB or Amazon S3 don't support rename/move operations. The users might not have permissions to perform a rename.
To disable archiving, leave this option empty.
By default, files are copied to the archive folder with timestamps inserted in their names to prevent overwriting previous files. See archive_format for the available naming options.
Timestamps are inserted before file extensions. When a file has no extension, the timestamp is appended to the file name as an extension.
Timestamps have the following format:
.YEAR-MONTH-DAY-HOUR-MINUTES-SECONDS-MILLISECONDS-RANDOMA file named README.rst will be archived as README.2014-12-03-13-00-57-967636-036.rst, while a file named README is README.2014-12-03-13-00-57-967636-036.
archive_failure_path#
- Default value:
Empty
- Optional:
Yes
- From version:
3.0.0
- Values:
Path
Empty
- Description:
Path to a folder on the local filesystem used to keep copies of files whose transfers started but failed.
Note
This is only supported when the source location is a local filesystem.
To disable archiving on failure, leave this option empty.
When execute_before or execute_on_destination_before commands fail, the file transfer is not considered started, and the archiving stage is not executed.
By default, files are copied to the archive folder with timestamps inserted in their names to prevent overwriting previous files. See archive_format for the available naming options. See archive_success_path for more details about the timestamp format.
archive_format#
- Default value:
timestamp-always
- Optional:
Yes
- From version:
4.0.0
- Values:
timestamp-always
exact
- Description:
This configuration defines the way archive files are created.
timestamp-always will archive all files using a timestamp. It will mirror the directory structure from the source folder.
exact will store the files using the same name and will mirror the directory structure from the source folder. If a file with the same name already exists, the new file is archived with a timestamp.
archive_retention_period#
- Default value:
0
- Optional:
Yes
- From version:
3.51.0
- Values:
Number of days.
0
- Description:
Number of days after which files in the configured archive folders are automatically removed, based on their modification time.
SFTPPlus checks for old files when the transfer starts and twice per day. Cleanup includes all files in the archive folders and their subfolders, even files that were not created by this transfer. Directories are kept.
The archive location must support deleting files.
Set this option to 0 to keep all files.