Skip to main content

Python wrapper for rclone

Project description

Rclone for Python

๐Ÿš€ Python wrapper for rclone.

Supported Python versions PEP8

Requirements

โฌ‡๏ธ Installation

pip install rclone

โŒจ๏ธ Usage

from rclone.rclone import Rclone

rc = Rclone()

๐Ÿ“• Examples

pathname = 'gdrive:/remote/path'  # you can also use a local path


rc.copy('foo.txt', 'remote:/path/to/dst')
# 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 0.16/0.16 [00:00<00:00,  1.13MB/s]
rc.move('bar.bin', 'remote:/path/to/dst')
# 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 0.16/0.16 [00:00<00:00,  1.34MB/s]
rc.unit = 'B'
rc.copy('foo.txt', 'remote:/path/to/dst')
# 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 159414.0/159414.0 [00:00<00:00, 1003822.00B/s]
rclone.ls('remote:/path/to/dir')
# ['foo.bin', 'bar.txt', 'foo/']
rclone.lsjson('remote:/path/to/dir')
# [
#     {
#         'Path': 'bar.txt',
#         'Name': 'bar.txt',
#         'Size': 0,
#         'MimeType': 'text/plain; charset=utf-8',
#         'ModTime': '2022-03-22T13:07:53.557168464-04:00',
#         'IsDir': False
#     }
# ]
rclone.ls('remote:/path/to/dir', '-R')  # you can supply additional flags to any command as positional argments
# ['foo.bin', 'bar.txt', 'foo/', 'foo/foo1.txt', 'foo/foo2', 'foo/bar/foobar.txt']
rclone.size('remote:/path/to/dir')
# {'total_objects': 5, 'total_size': 170397}

You can also use whatever subcommands/flags with execute():

# 
rclone.execute('ls "remote:/path/to/dir" --exclude *.txt')
#       27 foo.bin
#   159414 foo.csv.zip
#     4808 rclone.py

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-0.4.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

rclone-0.4.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file rclone-0.4.1.tar.gz.

File metadata

  • Download URL: rclone-0.4.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.10.5 Darwin/21.5.0

File hashes

Hashes for rclone-0.4.1.tar.gz
Algorithm Hash digest
SHA256 89f198b8d43421ebaf8dc4d2ca170fd7457f1619b761bffe1293df15c1f31d6b
MD5 13bfd648ab96e914981cba716d48e176
BLAKE2b-256 f1de2b6f3b7341972d8f335a9a1cdcd7dab13f1fb877647e1150452cef28d24d

See more details on using hashes here.

File details

Details for the file rclone-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: rclone-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.10.5 Darwin/21.5.0

File hashes

Hashes for rclone-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 953aa3936cd614a68c5950efdc858c917d4a5dfdc7876046314cc756cd362000
MD5 ce2f41aabd23d262b2c58b9dc5e64d75
BLAKE2b-256 0b0c8e4ba2e0ceaf9ad1f365a33fa4b89930506da75f7f0c162e1f0b134a29e9

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