Skip to content

Move files with post-copy cleanup

connect move [flags] source_files... destination

move copies files to a new location and deletes the source after each successful transfer. It is ideal for hand-offs where the inbox should be cleared automatically.

  • source_files... — one or more local/remote paths, globs, or regex filters.
  • destination — exactly one endpoint or alias receiving the files.
  • -r, --recursive — descend into directories referenced by the sources.
  • --flat — with --recursive, discard the original directory structure at the destination.
  • -p, --parallel — number of concurrent workers (default 1).
  • --timeout — network timeout in seconds (default 30).
  • --key, --src-key, --dst-key — SSH key material for SFTP transfers.
  • --batch, --progress, --compact, --stats-interval, --no-color, --quiet — control the logging style.
  • --failover-dst <uri> + --failover-sticky — retry a fallback target when the primary write fails.
  • --sftp-max-conn, --sftp-idle-timeout, --sftp-pool-disable — adjust the SFTP pool characteristics.
  • Start runs with --batch and capture logs to verify discovery before wiring into automation.
  • Keep an alias-based backup destination available through --failover-dst to avoid data loss.
  • Consider staging directories or versioned storage if files must survive on both sides.
Terminal window
# Move staging archives into SFTP
$ connect mv /data/outgoing/*.zip sftp://deploy:pass@10.0.0.5/incoming/
# Use aliases and parallel workers
$ connect mv -r --parallel 4 /exports/billing/@done/*.csv @warehouse/drop/
# Fall back to S3 when the primary SFTP endpoint fails
$ connect mv /exports/logs/*.gz sftp://ops@10.0.0.5/logs/ --failover-dst s3://backups/hourly/
# Move everything that matches a regex
$ connect mv /data/reports/regex:^report_.*\.json$ @warehouse/raw/