Skip to main content

A python wrapper for rclone.

Project description

MIT License PyPI version

rclone-python ☁️

A python wrapper for rclone that makes rclone's functionality usable in python. rclone needs to be installed on the system for the wrapper to work.

demo gif

Features ⚒️

  • Copy, move and sync files between remotes
  • Delete and prune files/directories
  • List files in a directory including properties of the files.
  • List available remotes.
  • Create new remotes
  • Check available remotes

Installation 💾

rclone_python can be installed using pip

pip install rclone-python

or by cloning this repository and running from within the root of the project

pip install .

How to use 💡

All functionally of this wrapper is accessible through rclone. The following example checks if rclone is installed.

from rclone_python import rclone

print(rclone.is_installed())
# True

Create new remote

Create a new rclone remote connection with rclone's default client-id and client-secret.

from rclone_python import rclone
from rclone_python.remote_types import RemoteTypes

rclone.create_remote('onedrive', RemoteTypes.onedrive)

Additionally, client-id and client-secret can be used with many cloud providers.

from rclone_python import rclone
from rclone_python.remote_types import RemoteTypes

rclone.create_remote('onedrive', RemoteTypes.onedrive, client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET')

Copy

from rclone_python import rclone

# copy all file in the test_dir on OneDrive to the local data folder.
rclone.copy('onedrive:data', 'data', ignore_existing=True, args=['--create-empty-src-dirs'])
# ☁ Copying:  48%|████▊     | 151.1/315.309 MiB, 13.9 MiB/s, ETA: 11s

Delete

Delete a file or a directory. When deleting a directory, only the files in the directory (and all it's subdirectories) are deleted, but the folders remain.

from rclone_python import rclone

# delete a specific file on onedrive
rclone.delete('onedrive:data/video1.mp4')

Prune

from rclone_python import rclone

# remove the entire test_dir folder (and all files contained in it and it's subdirectories) on onedrive
rclone.purge('onedrive:test_dir')

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

rclone-python-0.1.7.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rclone_python-0.1.7-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file rclone-python-0.1.7.tar.gz.

File metadata

  • Download URL: rclone-python-0.1.7.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for rclone-python-0.1.7.tar.gz
Algorithm Hash digest
SHA256 1e162883e6d64e5dd20a05300a5eef0f549b1e443344b7565c687d715fd1e3f2
MD5 dc554fa20c83099bfd4db966ae735ee6
BLAKE2b-256 dc127ec05db5504e174a152595cacfe620cd2d3380eebabe7468e08c4fe97162

See more details on using hashes here.

File details

Details for the file rclone_python-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: rclone_python-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for rclone_python-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 970dbb316641317694c291cfac65cd38d69b4ddceb5d62e9ff45cad8e63bf81c
MD5 a853abc30053cd31cdc6f4999d8a3b3f
BLAKE2b-256 d5544b6debada61ab238c32a2abac7ef019adbf2b02e6f525cead562f199e42c

See more details on using hashes here.

Supported by

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