You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[rclone](https://rclone.org) is a kind of swiss army knife for file transfer to cloud services.
5
+
It supports almost all services, such as FTP, SFTP, FTPS, WebDAV (which allows to support many systems such as OwnCloud, NextCloud, etc), Amazon S3, Alibaba Cloud, Box, Dropbox, DigitalOcean Spaces, Cloudfare R2, Google Drive, HiDrive, HTTP, Rackspace, Seafile, Zoho WorkDrive, just to name a few. See web site for full list.
6
+
7
+
The class follows the concept of the curl/dropbox/gdrive class to provide a similar interface to access these services, allowing to use a common code base.
8
+
9
+
rclone is usually used with a config file. Do a one time configuration using Terminal/Console to setup the remote system, dealing with OAuth and similar. Then use the same commands, whatever cloud you need to talk to.
10
+
11
+
Some cloud systems allow direct providing of credentials (such as FTP), some optional (such as Gdrive with Service Account support), some require OAUTH2 and need pre-setup.
12
+
See for each cloud service the "Config" button beside the list on [rclone](https://rclone.org).
13
+
I recommend to start with the configuration process as recommended on rclone web site, at least for first testing, even if a service allows direct usage.
14
+
15
+
Some cloud systems allow, some request additional parameters. Use .setPrefix() to add those.
16
+
17
+
# Usage example for a service configured as "mydrive"
18
+
19
+
```4D
20
+
var $ftp : cs.FileTransfer_rclone
21
+
$ftp:=cs.FileTransfer_rclone.new("mydrive")
22
+
$source:="/product/4D.dmg"
23
+
$target:=Convert path system to POSIX(System folder(Desktop))
24
+
$result:=$ftp.download($source; $target)
25
+
If ($result.success)
26
+
...
27
+
End if
28
+
```
29
+
30
+
# Usage example without configuration, passing all data
31
+
32
+
```4D
33
+
var $ftp : cs.FileTransfer_rclone
34
+
$ftp:=cs.FileTransfer_rclone.new(":ftp") // use :ftp or :http or :ftps or :S3, etc
35
+
$source:="/product/4D.dmg"
36
+
$target:=Convert path system to POSIX(System folder(Desktop))
Note: you need to obscure the password. You might want to store that instead of the clear password.
46
+
47
+
For more examples see the method "test_rclone".
48
+
Check the download part of the method to see how to use progress bar with Cancel Button.
49
+
50
+
# Feature overview
51
+
- Upload
52
+
- Download
53
+
- Directory Listing
54
+
- Rename and Delete (file and directory)
55
+
- Sync
56
+
57
+
# Installation
58
+
59
+
rclone is a command line tool supporting all standard file transfer operations:
60
+
[rclone](https://rclone.org)
61
+
62
+
The tool is written in the language 'go', which allows a compilation of an executable without any dependencies. This means you an easily deploy it as part of your application (in Resource folder or similar), it uses the MIT License,
63
+
64
+
To update, just download their latest release and replace the binary.
65
+
66
+
You can compile it yourself (see instruction in link above) or download a precompiled version.
67
+
68
+
For Windows the downloaded version could be placed in Resources folder and so easily deployed.
69
+
70
+
For Mac, the availalbe version is not signed, making deployment more difficult.
71
+
For testing or internal usage, just download and double click once with control-key pressed (to open Apple's Gatekeeper warning and confirm execution.) Future execution will work without confirm, so also by command language.
72
+
For deployment, you can either use my (downloaded from their web site and signed, based) or compile and sign yourself, to allow shipping it as notarized merged application inside the Resource folder.
73
+
74
+
Copy class methods:
75
+
FileTansfer_rclone.4dm
76
+
SytemWorkerProperties.4dm
77
+
Project Method ErrorHandler.4dm
78
+
79
+
If you already have a silent ErrorHandler method (no output, just to prevent an error message displayed on screen, error handled by code), just use your existing one.
80
+
81
+
Method ProgressCallback.4dm can be used as example how to create a progress bar - if needed.
82
+
83
+
Copy this 2-4 files into your project, done.
84
+
85
+
# Configuration
86
+
87
+
As explained in introduction, rclone authentication is based on a configuration file.
88
+
To create it, use a terminal window and (drag and drop your rconfig file to avoid entering the full path) enter:
89
+
rconfig config
90
+
This will ask interactive a list of questins, based on the service you want to use.
91
+
Read rconfig documentationf for details:
92
+
[config](https://rclone.org/docs/)
93
+
94
+
For some services you can pass credentials directly, see example in introduction or method rclone_test.
95
+
96
+
# Class Documentation
97
+
98
+
See Class documentation (in 4D use Explorer/Documentation)
0 commit comments