🧡 Skip to main content🔍 Skip to search
Thomas UnderwoodBy Thomas Underwood 🕘 Updated on June 16, 2022 at 9:00 am
YouTube video · Synchronize SFTP server files & documents

Suppose that there is an e-commerce website that generates PDF invoices for the customers. These files must be transferred to accounting department hourly. When synchronization is finished, an email report must be sent containing information about work done.

Get the Demo Task…

Overview

The Synchronize remote directories Action automatically scans for new, modified and deleted files, and detects which files must be transferred, thus reducing the time and data amount needed for automatic sync. The job is launched by built-in Task Scheduler Trigger, that must be added to the Task.

Task Scheduler · Recur every 1 hour

How to set up the automated file transfer? Add Connect to SFTP Action, and enter your server DNS name or an IP address, along with a username and password. Then add Synchronize Directories Action, and set the local and remote server directories. The Transfer mode must be set to Download, as we want our invoice files to be transferred from the remote server to the local machine.

Connect to SFTP and Synchronize Directories · Download

The last step is to add Send Email Action. Using Variable Wizard feature, we add the current date and time to the email subject, and two dynamic variables containing the count and the list of files transferred. Each time the email is sent, the message body contains data from the last download session.

Send email with a list of downloaded files

Summary

The task is ready and running. Task Scheduler Trigger starts the task every hour. Synchronize Directories Action automatically looks for new files on the remote server (similarly like WinSCP or robocopy command, but for SFTP), and when found, it transfers them securely to the local computer or server. Send Email Action sends messages to accounting department with information about invoices from the last hour.

Further fine-tune…

In the example above, an email is always sent, even when there are no new files to synchronize. By adding If Action, the sending of email can be suppressed if no files were transferred.

In this example the invoices can be accessed via SFTP server. However, Automation Workshop can access FTP & SFTP, WebDAV, Amazon S3, Google Cloud Storage, and DigitalOcean Spaces storage servers, or UNC network shares automatically.

Task Scheduler Trigger can be configured to not send emails during night-time or on weekends, to prevent clutter in the inbox.

Final note

Synchronize Directories Action outputs a list of files that uses pipe character as a separator. To format it in more readable format, use Convert List Action, as in the provided demo task.

Alternatively, use the Synchronize Folders Action to sync (push, pull, or two-way syncing modes) local and shared folders.

Just ask…

If you have any questions, please do not hesitate to contact our support team.