Skip to main content

Sync files and directories over SSH

Project description

Sync files and directories over SSH.

Update destination files according to the source size and modified time. Remove destination files and directories if not present at source or excluded (include/exclude parameters).

Example:

# We synchronize a stock Android phone sdcard mountpoint to our home (assuming a SSH server is running on the device)

from sftpsync import Sftp

sftp = Sftp(‘192.168.1.149’, ‘root’, ‘password’, port=2222)

src = ‘/mnt/sdcard’ dst = ‘/home/user/phone-backup/’

# We don’t want to backup everything exclude = [r’^Music/’, r’^Video/’]

sftp.sync(src, dst, download=True, exclude=exclude, delete=True)

# We sync a local directory to the phone src = ‘/home/user/data/code/sftpsync-py’ dst = ‘/mnt/sdcard/data/’

sftp.sync(src, dst, download=False, delete=True)

Install:

pip install sftpsync

or

conda install -c mjirik sftpsync

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sftpsync-1.0.6.tar.gz (6.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page