Skip to content

Tutorial: Migrating From Scripts to Xferity

Tutorial: Migrating From Scripts to Xferity

Section titled “Tutorial: Migrating From Scripts to Xferity”

This tutorial is for teams with existing shell scripts, WinSCP automation, or cron-based SFTP jobs who want to replace them with Xferity flows without disrupting ongoing operations.

Before migrating, document each existing script:

ScriptProtocolDirectionSchedulePartnerNotes
payroll_upload.shSFTPuploaddaily 06:00payroll-processorPGP encrypt
bank_pickup.shSFTPdownloadevery 15minbankNo PGP
insurance_claims.batFTPSuploadweekdays 08:00insurerPassive mode

Identify which scripts are doing transfer logic versus packaging, preprocessing, or other business logic. Xferity replaces the transfer logic, not the surrounding business logic.

Never migrate all scripts simultaneously. Migrate one flow at a time and run both the script and the Xferity flow in parallel until you confirm the Xferity flow is correct.

Start with the least critical, most straightforward script — usually a simple SFTP download without PGP.

For a script that does:

Terminal window
sftp username@sftp.partner.example << EOF
cd /outgoing
get *.csv /opt/data/incoming/
bye
EOF

Create a partner definition and flow:

partners/partner.yaml
id: partner
protocol: sftp
sftp:
host: sftp.partner.example
user: username
remote_dir: /outgoing
key_path: file:/etc/xferity/keys/partner_id_rsa
known_hosts: file:/etc/xferity/known_hosts
flows/partner-inbound.yaml
flows:
partner-inbound:
direction: download
enabled: true
source:
partner: partner
path: /outgoing
local:
path: /opt/data/incoming
files:
- pattern: "*.csv"
idempotency_mode: hash

Don’t disable the script yet. Run the Xferity flow manually in parallel:

Terminal window
xferity run partner-inbound --dry-run

Dry-run shows what would happen without actually downloading files.

Then run it for real:

Terminal window
xferity run partner-inbound

Compare results: same files, same count?

Enable the schedule on the Xferity flow but keep the script running. Verify both produce the same results. Use xferity trace <file> to confirm which files Xferity processed.

Once you’re confident Xferity is working correctly, disable the script (don’t delete it yet). Monitor for a few more cycles.

If your script calls gpg before upload:

Terminal window
gpg --recipient partner-key --encrypt --output file.csv.pgp file.csv
sftp username@sftp.partner.example <<< "put file.csv.pgp /incoming/"

Replace with PGP-enabled flow:

pgp:
provider: gopenpgp
encrypt: true
public_key_path: file:/etc/xferity/keys/partner-public.asc
delete_encrypted_after_upload: true

WinSCP scripts often have implicit trust workarounds (-hostkey=*). When migrating:

  • obtain the actual host key fingerprint and configure it in sftp.host_key_fingerprint
  • do not use allow_insecure_host_key=true as a direct replacement

Replace your cron expression timing with schedule_cron — but remember Xferity uses six-field cron with seconds first:

Old cron: */15 8-18 * * 1-5
Xferity: 0 */15 8-18 * * 1-5

  • migrating all scripts at once without parallel validation
  • forgetting to set host key verification (scripts often bypass it)
  • not testing idempotency behavior on rerun
  • keeping delete-after logic in both the script and the Xferity flow (double-delete)