From 1c26f40078e6a31afae7936c41db7617e090db57 Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Thu, 10 Jul 2025 14:17:42 +0200 Subject: [PATCH] docs: fix markdownlint issue md040/fenced-code-language --- CONTRIBUTING.md | 48 +++++++------- RELEASE.md | 24 +++---- docs/content/docs.md | 134 ++++++++++++++++++++------------------ docs/content/downloads.md | 12 ++-- docs/content/faq.md | 26 ++++---- docs/content/filtering.md | 87 ++++++++++++------------- docs/content/gui.md | 4 +- docs/content/install.md | 70 ++++++++++---------- docs/content/licence.md | 2 +- docs/content/overview.md | 10 +-- docs/content/rc.md | 84 ++++++++++++------------ 11 files changed, 252 insertions(+), 249 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e9f4cdae6..f2c2dec08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,7 @@ Then [install Git](https://git-scm.com/downloads) and set your public contributi Next open your terminal, change directory to your preferred folder and initialise your local rclone project: -``` +```sh git clone https://github.com/rclone/rclone.git cd rclone git remote rename origin upstream @@ -46,13 +46,13 @@ Note that most of the terminal commands in the rest of this guide must be execut Now [install Go](https://golang.org/doc/install) and verify your installation: -``` +```sh go version ``` Great, you can now compile and execute your own version of rclone: -``` +```sh go build ./rclone version ``` @@ -61,7 +61,7 @@ go build more accurate version number in the executable as well as enable you to specify more build options.) Finally make a branch to add your new feature -``` +```sh git checkout -b my-new-feature ``` @@ -71,7 +71,7 @@ You may like one of the [popular editors/IDE's for Go](https://github.com/golang When ready - test the affected functionality and run the unit tests for the code you changed -``` +```sh cd folder/with/changed/files go test -v ``` @@ -89,7 +89,7 @@ Make sure you When you are done with that push your changes to GitHub: -``` +```sh git push -u origin my-new-feature ``` @@ -106,7 +106,7 @@ You may sometimes be asked to [base your changes on the latest master](#basing-y Follow the guideline for [commit messages](#commit-messages) and then: -``` +```sh git checkout my-new-feature # To switch to your branch git status # To see the new and changed files git add FILENAME # To select FILENAME for the commit @@ -117,7 +117,7 @@ git log # To verify the commit. Use q to quit the log You can modify the message or changes in the latest commit using: -``` +```sh git commit --amend ``` @@ -129,7 +129,7 @@ Note that you are about to rewrite the GitHub history of your branch. It is good Your previously pushed commits are replaced by: -``` +```sh git push --force origin my-new-feature ``` @@ -137,7 +137,7 @@ git push --force origin my-new-feature To base your changes on the latest version of the [rclone master](https://github.com/rclone/rclone/tree/master) (upstream): -``` +```sh git checkout master git fetch upstream git merge --ff-only @@ -152,7 +152,7 @@ If you rebase commits that have been pushed to GitHub, then you will have to [re To combine your commits into one commit: -``` +```sh git log # To count the commits to squash, e.g. the last 2 git reset --soft HEAD~2 # To undo the 2 latest commits git status # To check everything is as expected @@ -160,13 +160,13 @@ git status # To check everything is as expected If everything is fine, then make the new combined commit: -``` +```sh git commit # To commit the undone commits as one ``` otherwise, you may roll back using: -``` +```sh git reflog # To check that HEAD{1} is your previous state git reset --soft 'HEAD@{1}' # To roll back to your previous state ``` @@ -194,13 +194,13 @@ Using these tests ensures that the rclone codebase all uses the same coding stan rclone's tests are run from the go testing framework, so at the top level you can run this to run all the tests. -``` +```sh go test -v ./... ``` You can also use `make`, if supported by your platform -``` +```sh make quicktest ``` @@ -220,7 +220,7 @@ need to make a remote called `TestDrive`. You can then run the unit tests in the drive directory. These tests are skipped if `TestDrive:` isn't defined. -``` +```sh cd backend/drive go test -v ``` @@ -229,7 +229,7 @@ You can then run the integration tests which test all of rclone's operations. Normally these get run against the local file system, but they can be run against any of the remotes. -``` +```sh cd fs/sync go test -v -remote TestDrive: go test -v -remote TestDrive: -fast-list @@ -242,7 +242,7 @@ If you want to use the integration test framework to run these tests altogether with an HTML report and test retries then from the project root: -``` +```sh go install github.com/rclone/rclone/fstest/test_all test_all -backends drive ``` @@ -252,14 +252,14 @@ test_all -backends drive If you want to run all the integration tests against all the remotes, then change into the project root and run -``` +```sh make check make test ``` The commands may require some extra go packages which you can install with -``` +```sh make build_dep ``` @@ -390,13 +390,13 @@ change will get linked into the issue. Here is an example of a short commit message: -``` +```text drive: add team drive support - fixes #885 ``` And here is an example of a longer one: -``` +```text mount: fix hang on errored upload In certain circumstances, if an upload failed then the mount could hang @@ -419,7 +419,7 @@ To add a dependency `github.com/ncw/new_dependency` see the instructions below. These will fetch the dependency and add it to `go.mod` and `go.sum`. -``` +```sh go get github.com/ncw/new_dependency ``` @@ -433,7 +433,7 @@ and `go.sum` in the same commit as your other changes. If you need to update a dependency then run -``` +```sh go get golang.org/x/crypto ``` diff --git a/RELEASE.md b/RELEASE.md index dd6da9de1..57f9bdec8 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -48,7 +48,7 @@ Early in the next release cycle update the dependencies. If the `make updatedirect` upgrades the version of go in the `go.mod` -``` +```text go 1.22.0 ``` @@ -59,7 +59,7 @@ If `make updatedirect` added a `toolchain` directive then remove it. We don't want to force a toolchain on our users. Linux packagers are often using a version of Go that is a few versions out of date. -``` +```sh go list -m -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' all > /tmp/potential-upgrades go get -d $(cat /tmp/potential-upgrades) go mod tidy -go=1.22 -compat=1.22 @@ -69,7 +69,7 @@ If the `go mod tidy` fails use the output from it to remove the package which can't be upgraded from `/tmp/potential-upgrades` when done -``` +```sh git co go.mod go.sum ``` @@ -101,7 +101,7 @@ The above procedure will not upgrade major versions, so v2 to v3. However this tool can show which major versions might need to be upgraded: -``` +```sh go run github.com/icholy/gomajor@latest list -major ``` @@ -111,7 +111,7 @@ Expect API breakage when updating major versions. At some point after the release run -``` +```sh bin/tidy-beta v1.55 ``` @@ -156,7 +156,7 @@ which is a private repo containing artwork from sponsors. Create an update website branch based off the last release -``` +```sh git co -b update-website ``` @@ -164,19 +164,19 @@ If the branch already exists, double check there are no commits that need saving Now reset the branch to the last release -``` +```sh git reset --hard v1.64.0 ``` Create the changes, check them in, test with `make serve` then -``` +```sh make upload_test_website ``` Check out https://test.rclone.org and when happy -``` +```sh make upload_website ``` @@ -186,14 +186,14 @@ Cherry pick any changes back to master and the stable branch if it is active. To do a basic build of rclone's docker image to debug builds locally: -``` +```sh docker buildx build --load -t rclone/rclone:testing --progress=plain . docker run --rm rclone/rclone:testing version ``` To test the multipatform build -``` +```sh docker buildx build -t rclone/rclone:testing --progress=plain --platform linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6 . ``` @@ -201,6 +201,6 @@ To make a full build then set the tags correctly and add `--push` Note that you can't only build one architecture - you need to build them all. -``` +```sh docker buildx build --platform linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6 -t rclone/rclone:1.54.1 -t rclone/rclone:1.54 -t rclone/rclone:1 -t rclone/rclone:latest --push . ``` diff --git a/docs/content/docs.md b/docs/content/docs.md index d36a2b412..45fbfc998 100644 --- a/docs/content/docs.md +++ b/docs/content/docs.md @@ -22,7 +22,7 @@ file and choose its location.) The easiest way to make the config is to run rclone with the config option: -``` +```sh rclone config ``` @@ -99,7 +99,7 @@ Rclone syncs a directory tree from one storage system to another. Its syntax is like this -``` +```sh rclone subcommand [options] ``` @@ -114,7 +114,7 @@ used before the `subcommand`. Anything after a `--` option will not be interpreted as an option so if you need to add a parameter which starts with a `-` then put a `--` on its own first, eg -``` +```sh rclone lsf -- -directory-starting-with-dash ``` @@ -135,7 +135,7 @@ learning rclone to avoid accidental data loss. rclone uses a system of subcommands. For example -``` +```sh rclone ls remote:path # lists a remote rclone copy /local/path remote:path # copies /local/path to the remote rclone sync --interactive /local/path remote:path # syncs /local/path to the remote @@ -188,7 +188,7 @@ directory` if it isn't. For example, suppose you have a remote with a file in called `test.jpg`, then you could copy just that file like this -``` +```sh rclone copy remote:test.jpg /tmp/download ``` @@ -196,13 +196,13 @@ The file `test.jpg` will be placed inside `/tmp/download`. This is equivalent to specifying -``` +```sh rclone copy --files-from /tmp/files remote: /tmp/download ``` Where `/tmp/files` contains the single line -``` +```sh test.jpg ``` @@ -248,25 +248,25 @@ the command line (or in environment variables). Here are some examples: -``` +```sh rclone lsd --http-url https://pub.rclone.org :http: ``` To list all the directories in the root of `https://pub.rclone.org/`. -``` +```sh rclone lsf --http-url https://example.com :http:path/to/dir ``` To list files and directories in `https://example.com/path/to/dir/` -``` +```sh rclone copy --http-url https://example.com :http:path/to/dir /tmp/dir ``` To copy files and directories in `https://example.com/path/to/dir` to `/tmp/dir`. -``` +```sh rclone copy --sftp-host example.com :sftp:path/to/dir /tmp/dir ``` @@ -280,7 +280,7 @@ syntax, so instead of providing the arguments as command line parameters `--http-url https://pub.rclone.org` they are provided as part of the remote specification as a kind of connection string. -``` +```sh rclone lsd ":http,url='https://pub.rclone.org':" rclone lsf ":http,url='https://example.com':path/to/dir" rclone copy ":http,url='https://example.com':path/to/dir" /tmp/dir @@ -291,7 +291,7 @@ These can apply to modify existing remotes as well as create new remotes with the on the fly syntax. This example is equivalent to adding the `--drive-shared-with-me` parameter to the remote `gdrive:`. -``` +```sh rclone lsf "gdrive,shared_with_me:path/to/dir" ``` @@ -302,13 +302,13 @@ file shared on google drive to the normal drive which **does not work** because the `--drive-shared-with-me` flag applies to both the source and the destination. -``` +```sh rclone copy --drive-shared-with-me gdrive:shared-file.txt gdrive: ``` However using the connection string syntax, this does work. -``` +```sh rclone copy "gdrive,shared_with_me:shared-file.txt" gdrive: ``` @@ -317,13 +317,13 @@ backend. If for example gdriveCrypt is a crypt based on gdrive, then the following command **will not work** as intended, because `shared_with_me` is ignored by the crypt backend: -``` +```sh rclone copy "gdriveCrypt,shared_with_me:shared-file.txt" gdriveCrypt: ``` The connection strings have the following syntax -``` +```sh remote,parameter=value,parameter2=value2:path/to/dir :backend,parameter=value,parameter2=value2:path/to/dir ``` @@ -331,7 +331,7 @@ remote,parameter=value,parameter2=value2:path/to/dir If the `parameter` has a `:` or `,` then it must be placed in quotes `"` or `'`, so -``` +```sh remote,parameter="colon:value",parameter2="comma,value":path/to/dir :backend,parameter='colon:value',parameter2='comma,value':path/to/dir ``` @@ -339,7 +339,7 @@ remote,parameter="colon:value",parameter2="comma,value":path/to/dir If a quoted value needs to include that quote, then it should be doubled, so -``` +```sh remote,parameter="with""quote",parameter2='with''quote':path/to/dir ``` @@ -350,13 +350,13 @@ If you leave off the `=parameter` then rclone will substitute `=true` which works very well with flags. For example, to use s3 configured in the environment you could use: -``` +```sh rclone lsd :s3,env_auth: ``` Which is equivalent to -``` +```sh rclone lsd :s3,env_auth=true: ``` @@ -368,7 +368,7 @@ If you are a shell master then you'll know which strings are OK and which aren't, but if you aren't sure then enclose them in `"` and use `'` as the inside quote. This syntax works on all OSes. -``` +```sh rclone copy ":http,url='https://example.com':path/to/dir" /tmp/dir ``` @@ -377,7 +377,7 @@ strings in the shell (notably `\` and `$` and `"`) so if your strings contain those you can swap the roles of `"` and `'` thus. (This syntax does not work on Windows.) -``` +```sh rclone copy ':http,url="https://example.com":path/to/dir' /tmp/dir ``` @@ -387,13 +387,13 @@ If you supply extra configuration to a backend by command line flag, environment variable or connection string then rclone will add a suffix based on the hash of the config to the name of the remote, eg -``` +```sh rclone -vv lsf --s3-chunk-size 20M s3: ``` Has the log message -``` +```sh DEBUG : s3: detected overridden config - adding "{Srj1p}" suffix to name ``` @@ -404,13 +404,13 @@ This should only be noticeable in the logs. This means that on the fly backends such as -``` +```sh rclone -vv lsf :s3,env_auth: ``` Will get their own names -``` +```sh DEBUG : :s3: detected overridden config - adding "{YTu53}" suffix to name ``` @@ -447,13 +447,13 @@ Here are some gotchas which may help users unfamiliar with the shell rules If your names have spaces or shell metacharacters (e.g. `*`, `?`, `$`, `'`, `"`, etc.) then you must quote them. Use single quotes `'` by default. -``` +```sh rclone copy 'Important files?' remote:backup ``` If you want to send a `'` you will need to use `"`, e.g. -``` +```sh rclone copy "O'Reilly Reviews" remote:backup ``` @@ -465,14 +465,14 @@ shell. If your names have spaces in you need to put them in `"`, e.g. -``` +```bat rclone copy "E:\folder name\folder name\folder name" remote:backup ``` If you are using the root directory on its own then don't quote it (see [#464](https://github.com/rclone/rclone/issues/464) for why), e.g. -``` +```bat rclone copy E:\ remote:backup ``` @@ -486,13 +486,13 @@ file or directory like this then use the full path starting with a So to sync a directory called `sync:me` to a remote called `remote:` use -``` +```sh rclone sync --interactive ./sync:me remote:path ``` or -``` +```sh rclone sync --interactive /full/path/to/sync:me remote:path ``` @@ -507,7 +507,7 @@ to copy them in place. Eg -``` +```sh rclone copy s3:oldbucket s3:newbucket ``` @@ -528,7 +528,7 @@ same. This can be used when scripting to make aged backups efficiently, e.g. -``` +```sh rclone sync --interactive remote:current-backup remote:previous-backup rclone sync --interactive /path/to/files remote:current-backup ``` @@ -768,7 +768,7 @@ excluded by a filter rule. For example -``` +```sh rclone sync --interactive /path/to/local remote:current --backup-dir remote:old ``` @@ -796,7 +796,7 @@ You can use `--bind 0.0.0.0` to force rclone to use IPv4 addresses and This option controls the bandwidth limit. For example -``` +```sh --bwlimit 10M ``` @@ -808,7 +808,7 @@ suffix B|K|M|G|T|P. The default is `0` which means to not limit bandwidth. The upload and download bandwidth can be specified separately, as `--bwlimit UP:DOWN`, so -``` +```sh --bwlimit 10M:100k ``` @@ -816,7 +816,7 @@ would mean limit the upload bandwidth to 10 MiB/s and the download bandwidth to 100 KiB/s. Either limit can be "off" meaning no limit, so to just limit the upload bandwidth you would use -``` +```sh --bwlimit 10M:off ``` @@ -872,11 +872,15 @@ be unlimited. Timeslots without `WEEKDAY` are extended to the whole week. So this example: -`--bwlimit "Mon-00:00,512 12:00,1M Sun-20:00,off"` +```sh +--bwlimit "Mon-00:00,512 12:00,1M Sun-20:00,off" +``` Is equivalent to this: -`--bwlimit "Mon-00:00,512Mon-12:00,1M Tue-12:00,1M Wed-12:00,1M Thu-12:00,1M Fri-12:00,1M Sat-12:00,1M Sun-12:00,1M Sun-20:00,off"` +```sh +--bwlimit "Mon-00:00,512Mon-12:00,1M Tue-12:00,1M Wed-12:00,1M Thu-12:00,1M Fri-12:00,1M Sat-12:00,1M Sun-12:00,1M Sun-20:00,off" +``` Bandwidth limit apply to the data transfer for all backends. For most backends the directory listing bandwidth is also included (exceptions @@ -894,14 +898,14 @@ of a long running rclone transfer and to restore it back to the value specified with `--bwlimit` quickly when needed. Assuming there is only one rclone instance running, you can toggle the limiter like this: -``` +```sh kill -SIGUSR2 $(pidof rclone) ``` If you configure rclone with a [remote control](/rc) then you can use change the bwlimit dynamically: -``` +```sh rclone rc core/bwlimit rate=1M ``` @@ -912,7 +916,7 @@ This option controls per file bandwidth limit. For the options see the For example use this to allow no transfers to be faster than 1 MiB/s -``` +```sh --bwlimit-file 1M ``` @@ -1114,7 +1118,7 @@ beginning of a line. Example: -``` +```ini [megaremote] type = mega user = you@example.com @@ -1199,7 +1203,7 @@ time rclone started up. This disables a comma separated list of optional features. For example to disable server-side move and server-side copy use: -``` +```sh --disable move,copy ``` @@ -1207,13 +1211,13 @@ The features can be put in any case. To see a list of which features can be disabled use: -``` +```sh --disable help ``` The features a remote has can be seen in JSON format with: -``` +```sh rclone backend features remote: ``` @@ -1252,7 +1256,7 @@ can avoid occupying too much bandwidth in a network with DiffServ support ([RFC For example, if you configured QoS on router to handle LE properly. Running: -``` +```sh rclone copy --dscp LE from:/from to:/to ``` @@ -1344,7 +1348,7 @@ This flag is supported for all HTTP based backends even those not supported by `--header-upload` and `--header-download` so may be used as a workaround for those with care. -``` +```sh rclone ls remote:test --header "X-Rclone: Foo" --header "X-LetMeIn: Yes" ``` @@ -1353,7 +1357,7 @@ rclone ls remote:test --header "X-Rclone: Foo" --header "X-LetMeIn: Yes" Add an HTTP header for all download transactions. The flag can be repeated to add multiple headers. -``` +```sh rclone sync --interactive s3:test/src ~/dst --header-download "X-Amz-Meta-Test: Foo" --header-download "X-Amz-Meta-Test2: Bar" ``` @@ -1365,7 +1369,7 @@ currently supported backends. Add an HTTP header for all upload transactions. The flag can be repeated to add multiple headers. -``` +```sh rclone sync --interactive ~/src s3:test/dst --header-upload "Content-Disposition: attachment; filename='cool.html'" --header-upload "X-Amz-Meta-Test: FooBar" ``` @@ -1493,7 +1497,7 @@ temporary file with an extension like this, where `XXXXXX` represents a hash of the source file's fingerprint and `.partial` is [--partial-suffix](#partial-suffix) value (`.partial` by default). -``` +```text original-file-name.XXXXXX.partial ``` @@ -1534,7 +1538,7 @@ especially with `rclone sync`. For example -``` +```sh $ rclone delete --interactive /tmp/dir rclone: delete "important-file.txt"? y) Yes, this is OK (default) @@ -1667,7 +1671,7 @@ once as administrator to create the registry key in advance. severe) than or equal to the `--log-level`. For example to log DEBUG to a log file but ERRORs to the event log you would use -``` +```sh --log-file rclone.log --log-level DEBUG --windows-event-log ERROR ``` @@ -1898,7 +1902,7 @@ it in `"`, if you want a literal `"` in an argument then enclose the argument in `"` and double the `"`. See [CSV encoding](https://godoc.org/encoding/csv) for more info. -``` +```sh --metadata-mapper "python bin/test_metadata_mapper.py" --metadata-mapper 'python bin/test_metadata_mapper.py "argument with a space"' --metadata-mapper 'python bin/test_metadata_mapper.py "argument with ""two"" quotes"' @@ -2268,7 +2272,7 @@ for more info. Eg -``` +```sh --password-command "echo hello" --password-command 'echo "hello with space"' --password-command 'echo "hello with ""quotes"" and space"' @@ -2472,7 +2476,7 @@ or with `--backup-dir`. See `--backup-dir` for more info. For example -``` +```sh rclone copy --interactive /path/to/local/file remote:current --suffix .bak ``` @@ -2483,7 +2487,7 @@ If using `rclone sync` with `--suffix` and without `--backup-dir` then it is recommended to put a filter rule in excluding the suffix otherwise the `sync` will delete the backup files. -``` +```sh rclone sync --interactive /path/to/local/file remote:current --suffix .bak --exclude "*.bak" ``` @@ -2851,8 +2855,8 @@ have to supply the password every time you start rclone. To add a password to your rclone configuration, execute `rclone config`. -``` ->rclone config +```sh +$ rclone config Current remotes: e) Edit existing remote @@ -2865,7 +2869,7 @@ e/n/d/s/q> Go into `s`, Set configuration password: -``` +```sh e/n/d/s/q> s Your configuration is not encrypted. If you add a password, you will protect your login information to cloud services. @@ -3263,7 +3267,7 @@ so it can only contain letters, digits, or the `_` (underscore) character. For example, to configure an S3 remote named `mys3:` without a config file (using unix ways of setting environment variables): -``` +```sh $ export RCLONE_CONFIG_MYS3_TYPE=s3 $ export RCLONE_CONFIG_MYS3_ACCESS_KEY_ID=XXX $ export RCLONE_CONFIG_MYS3_SECRET_ACCESS_KEY=XXX @@ -3283,7 +3287,7 @@ You must write the name in uppercase in the environment variable, but as seen from example above it will be listed and can be accessed in lowercase, while you can also refer to the same remote in uppercase: -``` +```sh $ rclone lsd mys3: -1 2016-09-21 12:54:21 -1 my-bucket $ rclone lsd MYS3: @@ -3298,7 +3302,7 @@ set the access key of all remotes using S3, including myS3Crypt. Note also that now rclone has [connection strings](#connection-strings), it is probably easier to use those instead which makes the above example -``` +```sh rclone lsd :s3,access_key_id=XXX,secret_access_key=XXX: ``` diff --git a/docs/content/downloads.md b/docs/content/downloads.md index 958d8dca1..0c64496ab 100644 --- a/docs/content/downloads.md +++ b/docs/content/downloads.md @@ -51,13 +51,13 @@ signatures on the release. To install rclone on Linux/macOS/BSD systems, run: -``` +```sh sudo -v ; curl https://rclone.org/install.sh | sudo bash ``` For beta installation, run: -``` +```sh sudo -v ; curl https://rclone.org/install.sh | sudo bash -s beta ``` @@ -69,13 +69,13 @@ won't re-download if not needed. [Beta releases](https://beta.rclone.org) are generated from each commit to master. Note these are named like -``` +```text {Version Tag}.beta.{Commit Number}.{Git Commit Hash} ``` e.g. -``` +```text v1.53.0-beta.4677.b657a2204 ``` @@ -87,13 +87,13 @@ and will normally be at the end of the list. Some beta releases may have a branch name also: -``` +```text {Version Tag}-beta.{Commit Number}.{Git Commit Hash}.{Branch Name} ``` e.g. -``` +```text v1.53.0-beta.4677.b657a2204.semver ``` diff --git a/docs/content/faq.md b/docs/content/faq.md index 14cbd6ae1..e0ef2d719 100644 --- a/docs/content/faq.md +++ b/docs/content/faq.md @@ -32,7 +32,7 @@ If you need to configure a remote, see the [config help docs](/docs/#configure). If you are using rclone entirely with [on the fly remotes](/docs/#backend-path-to-dir), you can create an empty config file to get rid of this notice, for example: -``` +```sh rclone config touch ``` @@ -47,7 +47,7 @@ The syncs would be incremental (on a file by file basis). e.g. -``` +```sh rclone sync --interactive drive:Folder s3:bucket ``` @@ -56,7 +56,7 @@ rclone sync --interactive drive:Folder s3:bucket You can use rclone from multiple places at the same time if you choose different subdirectory for the output, e.g. -``` +```sh Server A> rclone sync --interactive /tmp/whatever remote:ServerA Server B> rclone sync --interactive /tmp/whatever remote:ServerB ``` @@ -64,7 +64,7 @@ Server B> rclone sync --interactive /tmp/whatever remote:ServerB If you sync to the same directory then you should use rclone copy otherwise the two instances of rclone may delete each other's files, e.g. -``` +```sh Server A> rclone copy /tmp/whatever remote:Backup Server B> rclone copy /tmp/whatever remote:Backup ``` @@ -118,7 +118,7 @@ may use `http_proxy` but another one `HTTP_PROXY`. The `Go` libraries used by `rclone` will try both variations, but you may wish to set all possibilities. So, on Linux, you may end up with code similar to -``` +```sh export http_proxy=http://proxyserver:12345 export https_proxy=$http_proxy export HTTP_PROXY=$http_proxy @@ -127,7 +127,7 @@ export HTTPS_PROXY=$http_proxy Note: If the proxy server requires a username and password, then use -``` +```sh export http_proxy=http://username:password@proxyserver:12345 export https_proxy=$http_proxy export HTTP_PROXY=$http_proxy @@ -140,7 +140,7 @@ For instance "foo.com" also matches "bar.foo.com". e.g. -``` +```sh export no_proxy=localhost,127.0.0.0/8,my.host.name export NO_PROXY=$no_proxy ``` @@ -156,7 +156,7 @@ possibly on Solaris. Rclone (via the Go runtime) tries to load the root certificates from these places on Linux. -``` +```sh "/etc/ssl/certs/ca-certificates.crt", // Debian/Ubuntu/Gentoo etc. "/etc/pki/tls/certs/ca-bundle.crt", // Fedora/RHEL "/etc/ssl/ca-bundle.pem", // OpenSUSE @@ -166,7 +166,7 @@ these places on Linux. So doing something like this should fix the problem. It also sets the time which is important for SSL to work properly. -``` +```sh mkdir -p /etc/ssl/certs/ curl -o /etc/ssl/certs/ca-certificates.crt https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt ntpclient -s -h pool.ntp.org @@ -177,7 +177,7 @@ provide an additional way to provide the SSL root certificates. Note that you may need to add the `--insecure` option to the `curl` command line if it doesn't work without. -``` +```sh curl --insecure -o /etc/ssl/certs/ca-certificates.crt https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt ``` @@ -202,7 +202,7 @@ versions' file formats This happens when rclone cannot resolve a domain. Please check that your DNS setup is generally working, e.g. -``` +```sh # both should print a long list of possible IP addresses dig www.googleapis.com # resolve using your default DNS dig www.googleapis.com @8.8.8.8 # resolve with Google's DNS server @@ -223,7 +223,7 @@ from source with CGO enabled if necessary). See the ### Failed to start auth webserver on Windows ### -``` +```text Error: config failed to refresh token: failed to start auth webserver: listen tcp 127.0.0.1:53682: bind: An attempt was made to access a socket in a way forbidden by its access permissions. ... yyyy/mm/dd hh:mm:ss Fatal error: config failed to refresh token: failed to start auth webserver: listen tcp 127.0.0.1:53682: bind: An attempt was made to access a socket in a way forbidden by its access permissions. @@ -233,7 +233,7 @@ This is sometimes caused by the Host Network Service causing issues with opening A simple solution may be restarting the Host Network Service with eg. Powershell -``` +```pwsh Restart-Service hns ``` diff --git a/docs/content/filtering.md b/docs/content/filtering.md index c0993ec98..730b3e986 100644 --- a/docs/content/filtering.md +++ b/docs/content/filtering.md @@ -39,7 +39,7 @@ Here is a formal definition of the pattern syntax, Rclone matching rules follow a glob style: -``` +```text * matches any sequence of non-separator (/) characters ** matches any sequence of characters including / separators ? matches any single non-separator (/) character @@ -55,8 +55,7 @@ c matches character c (c != *, **, ?, \, [, {, }) character-range: -``` - +```text c matches character c (c != \, -, ]) \c matches reserved character c (c = \, -, ]) lo - hi matches character c for lo <= c <= hi @@ -64,14 +63,14 @@ lo - hi matches character c for lo <= c <= hi pattern-list: -``` +```text pattern { , pattern } comma-separated (without spaces) patterns ``` character classes (see [Go regular expression reference](https://golang.org/pkg/regexp/syntax/)) include: -``` +```text Named character classes (e.g. [\d], [^\d], [\D], [^\D]) Perl character classes (e.g. \s, \S, \w, \W) ASCII character classes (e.g. [[:alnum:]], [[:alpha:]], [[:punct:]], [[:xdigit:]]) @@ -79,7 +78,7 @@ ASCII character classes (e.g. [[:alnum:]], [[:alpha:]], [[:punct:]], [[:xdigit:] regexp for advanced users to insert a regular expression - see [below](#regexp) for more info: -``` +```text Any re2 regular expression not containing `}}` ``` @@ -91,7 +90,7 @@ starting at the **end of the path/file name** but it only matches a complete path element - it must match from a `/` separator or the beginning of the path/file. -``` +```text file.jpg - matches "file.jpg" - matches "directory/file.jpg" - doesn't match "afile.jpg" @@ -105,7 +104,7 @@ The top level of the remote might not be the top level of the drive. E.g. for a Microsoft Windows local directory structure -``` +```text F: ├── bkp ├── data @@ -128,14 +127,14 @@ Simple patterns are case sensitive unless the `--ignore-case` flag is used. Without `--ignore-case` (default) -``` +```text potato - matches "potato" - doesn't match "POTATO" ``` With `--ignore-case` -``` +```text potato - matches "potato" - matches "POTATO" ``` @@ -160,20 +159,20 @@ the supplied regular expression(s). Here is how the `{{regexp}}` is transformed into an full regular expression to match the entire path: -``` +```text {{regexp}} becomes (^|/)(regexp)$ /{{regexp}} becomes ^(regexp)$ ``` Regexp syntax can be mixed with glob syntax, for example -``` +```text *.{{jpe?g}} to match file.jpg, file.jpeg but not file.png ``` You can also use regexp flags - to set case insensitive, for example -``` +```text *.{{(?i)jpg}} to match file.jpg, file.JPG but not file.png ``` @@ -181,13 +180,13 @@ Be careful with wildcards in regular expressions - you don't want them to match path separators normally. To match any file name starting with `start` and ending with `end` write -``` +```text {{start[^/]*end\.jpg}} ``` Not -``` +```text {{start.*end\.jpg}} ``` @@ -319,13 +318,13 @@ command specify the `--dump filters` flag. E.g. for an include rule -``` +```text /a/*.jpg ``` Rclone implies the directory include rule -``` +```text /a/ ``` @@ -341,7 +340,7 @@ access to the remote by ignoring everything outside of that directory. E.g. `rclone ls remote: --filter-from filter-list.txt` with a file `filter-list.txt`: -``` +```text - /dir1/ - /dir2/ + *.pdf @@ -364,7 +363,7 @@ from this pattern list. E.g. for an include rule -``` +```text {dir1/**,dir2/**} ``` @@ -418,7 +417,7 @@ named file. The file contains a list of remarks and pattern rules. For an example `exclude-file.txt`: -``` +```text # a sample exclude rule file *.bak file2.jpg @@ -465,14 +464,14 @@ E.g. `rclone ls remote: --include "*.{png,jpg}"` lists the files on E.g. multiple rclone copy commands can be combined with `--include` and a pattern-list. -``` +```sh rclone copy /vol1/A remote:A rclone copy /vol1/B remote:B ``` is equivalent to: -``` +```sh rclone copy /vol1 remote: --include "{A,B}/**" ``` @@ -488,7 +487,7 @@ named file. The file contains a list of remarks and pattern rules. For an example `include-file.txt`: -``` +```text # a sample include rule file *.jpg file2.avi @@ -554,7 +553,7 @@ Lines starting with # or ; are ignored, and can be used to write comments. Inlin E.g. for `filter-file.txt`: -``` +```text # a sample filter rule file - secret*.jpg + *.jpg @@ -575,7 +574,7 @@ everything in the directory `dir` at the root of `remote`, except E.g. for an alternative `filter-file.txt`: -``` +```text - secret*.jpg + *.jpg + *.png @@ -588,7 +587,7 @@ Files `file1.jpg`, `file3.png` and `file2.avi` are listed whilst E.g. for an alternative `filter-file.txt`: -``` +```text + *.jpg + *.gif ! @@ -637,7 +636,7 @@ you need the input to be processed in a raw manner. E.g. for a file `files-from.txt`: -``` +```text # comment file1.jpg subdir/file2.jpg @@ -646,14 +645,14 @@ subdir/file2.jpg `rclone copy --files-from files-from.txt /home/me/pics remote:pics` copies the following, if they exist, and only those files. -``` +```text /home/me/pics/file1.jpg → remote:pics/file1.jpg /home/me/pics/subdir/file2.jpg → remote:pics/subdir/file2.jpg ``` E.g. to copy the following files referenced by their absolute paths: -``` +```text /home/user1/42 /home/user1/dir/ford /home/user2/prefect @@ -663,7 +662,7 @@ First find a common subdirectory - in this case `/home` and put the remaining files in `files-from.txt` with or without leading `/`, e.g. -``` +```text user1/42 user1/dir/ford user2/prefect @@ -671,13 +670,13 @@ user2/prefect Then copy these to a remote: -``` +```sh rclone copy --files-from files-from.txt /home remote:backup ``` The three files are transferred as follows: -``` +```text /home/user1/42 → remote:backup/user1/important /home/user1/dir/ford → remote:backup/user1/dir/file /home/user2/prefect → remote:backup/user2/stuff @@ -685,7 +684,7 @@ The three files are transferred as follows: Alternatively if `/` is chosen as root `files-from.txt` will be: -``` +```text /home/user1/42 /home/user1/dir/ford /home/user2/prefect @@ -693,13 +692,13 @@ Alternatively if `/` is chosen as root `files-from.txt` will be: The copy command will be: -``` +```sh rclone copy --files-from files-from.txt / remote:backup ``` Then there will be an extra `home` directory on the remote: -``` +```text /home/user1/42 → remote:backup/home/user1/42 /home/user1/dir/ford → remote:backup/home/user1/dir/ford /home/user2/prefect → remote:backup/home/user2/prefect @@ -798,7 +797,7 @@ The `--hash-filter` flag enables selecting a deterministic subset of files, usef The flag takes two parameters expressed as a fraction: -``` +```sh --hash-filter K/N ``` @@ -816,7 +815,7 @@ Each partition is non-overlapping, ensuring all files are covered without duplic Use `@` as `K` to randomly select a partition: -``` +```sh --hash-filter @/M ``` @@ -844,7 +843,7 @@ For example, `--hash-filter @/3` will randomly select a number between 0 and 2. Assuming the current directory contains `file1.jpg` through `file9.jpg`: -``` +```sh $ rclone lsf --hash-filter 0/4 . file1.jpg file5.jpg @@ -869,13 +868,13 @@ file5.jpg ##### Syncing the first quarter of files -``` +```sh rclone sync --hash-filter 1/4 source:path destination:path ``` ##### Checking a random 1% of files for integrity -``` +```sh rclone check --download --hash-filter @/100 source:path destination:path ``` @@ -891,7 +890,7 @@ on the destination which are excluded from the command. E.g. the scope of `rclone sync --interactive A: B:` can be restricted: -``` +```sh rclone --min-size 50k --delete-excluded sync A: B: ``` @@ -917,7 +916,7 @@ This flag has a priority over other filter flags. E.g. for the following directory structure: -``` +```text dir1/file1 dir1/dir2/file2 dir1/dir2/dir3/file3 @@ -940,13 +939,13 @@ expressions](#regexp). For example if you wished to list only local files with a mode of `100664` you could do that with: -``` +```sh rclone lsf -M --files-only --metadata-include "mode=100664" . ``` Or if you wished to show files with an `atime`, `mtime` or `btime` at a given date: -``` +```sh rclone lsf -M --files-only --metadata-include "[abm]time=2022-12-16*" . ``` diff --git a/docs/content/gui.md b/docs/content/gui.md index b789aeb18..c4591e0d3 100644 --- a/docs/content/gui.md +++ b/docs/content/gui.md @@ -13,13 +13,13 @@ change. Run this command in a terminal and rclone will download and then display the GUI in a web browser. -``` +```sh rclone rcd --rc-web-gui ``` This will produce logs like this and rclone needs to continue to run to serve the GUI: -``` +```text 2019/08/25 11:40:14 NOTICE: A new release for gui is present at https://github.com/rclone/rclone-webui-react/releases/download/v0.0.6/currentbuild.zip 2019/08/25 11:40:14 NOTICE: Downloading webgui binary. Please wait. [Size: 3813937, Path : /home/USER/.cache/rclone/webgui/v0.0.6.zip] 2019/08/25 11:40:16 NOTICE: Unzipping diff --git a/docs/content/install.md b/docs/content/install.md index 90ff5e36d..fe3a19d0b 100644 --- a/docs/content/install.md +++ b/docs/content/install.md @@ -29,13 +29,13 @@ signatures on the release. To install rclone on Linux/macOS/BSD systems, run: -``` +```sh sudo -v ; curl https://rclone.org/install.sh | sudo bash ``` For beta installation, run: -``` +```sh sudo -v ; curl https://rclone.org/install.sh | sudo bash -s beta ``` @@ -48,7 +48,7 @@ won't re-download if not needed. Fetch and unpack -``` +```sh curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip unzip rclone-current-linux-amd64.zip cd rclone-*-linux-amd64 @@ -56,7 +56,7 @@ cd rclone-*-linux-amd64 Copy binary file -``` +```sh sudo cp rclone /usr/bin/ sudo chown root:root /usr/bin/rclone sudo chmod 755 /usr/bin/rclone @@ -64,7 +64,7 @@ sudo chmod 755 /usr/bin/rclone Install manpage -``` +```sh sudo mkdir -p /usr/local/share/man/man1 sudo cp rclone.1 /usr/local/share/man/man1/ sudo mandb @@ -72,7 +72,7 @@ sudo mandb Run `rclone config` to setup. See [rclone config docs](/docs/) for more details. -``` +```sh rclone config ``` @@ -80,7 +80,7 @@ rclone config ### Installation with brew {#macos-brew} -``` +```sh brew install rclone ``` @@ -98,7 +98,7 @@ developers so it may be out of date. Its current version is as below. On macOS, rclone can also be installed via [MacPorts](https://www.macports.org): -``` +```sh sudo port install rclone ``` @@ -116,19 +116,19 @@ notarized it is enough to download with `curl`. Download the latest version of rclone. -``` +```sh cd && curl -O https://downloads.rclone.org/rclone-current-osx-amd64.zip ``` Unzip the download and cd to the extracted folder. -``` +```sh unzip -a rclone-current-osx-amd64.zip && cd rclone-*-osx-amd64 ``` Move rclone to your $PATH. You will be prompted for your password. -``` +```sh sudo mkdir -p /usr/local/bin sudo mv rclone /usr/local/bin/ ``` @@ -137,13 +137,13 @@ sudo mv rclone /usr/local/bin/ Remove the leftover files. -``` +```sh cd .. && rm -rf rclone-*-osx-amd64 rclone-current-osx-amd64.zip ``` Run `rclone config` to setup. See [rclone config docs](/docs/) for more details. -``` +```sh rclone config ``` @@ -153,14 +153,14 @@ When downloading a binary with a web browser, the browser will set the macOS gatekeeper quarantine attribute. Starting from Catalina, when attempting to run `rclone`, a pop-up will appear saying: -``` +```sh "rclone" cannot be opened because the developer cannot be verified. macOS cannot verify that this app is free from malware. ``` The simplest fix is to run -``` +```sh xattr -d com.apple.quarantine rclone ``` @@ -194,13 +194,13 @@ feature then you will need to install the third party utility To install rclone -``` +```bat winget install Rclone.Rclone ``` To uninstall rclone -``` +```bat winget uninstall Rclone.Rclone --force ``` @@ -208,7 +208,7 @@ winget uninstall Rclone.Rclone --force Make sure you have [Choco](https://chocolatey.org/) installed -``` +```bat choco search rclone choco install rclone ``` @@ -216,7 +216,7 @@ choco install rclone This will install rclone on your Windows machine. If you are planning to use [rclone mount](/commands/rclone_mount/) then -``` +```bat choco install winfsp ``` @@ -231,7 +231,7 @@ developers so it may be out of date. Its current version is as below. Make sure you have [Scoop](https://scoop.sh/) installed -``` +```bat scoop install rclone ``` @@ -271,7 +271,7 @@ The `:latest` tag will always point to the latest stable release. You can use the `:beta` tag to get the latest build from master. You can also use version tags, e.g. `:1.49.1`, `:1.49` or `:1`. -``` +```sh $ docker pull rclone/rclone:latest latest: Pulling from rclone/rclone Digest: sha256:0e0ced72671989bb837fea8e88578b3fc48371aa45d209663683e24cfdaa0e11 @@ -315,7 +315,7 @@ from the rclone image. Here are some commands tested on an Ubuntu 18.04.3 host: -``` +```sh # config on host at ~/.config/rclone/rclone.conf # data on host at ~/data @@ -353,7 +353,7 @@ kill %1 Make sure you have [Snapd installed](https://snapcraft.io/docs/installing-snapd) -```bash +```sh sudo snap install rclone ``` @@ -377,7 +377,7 @@ Go version 1.22 or newer is required, the latest release is recommended. You can get it from your package manager, or download it from [golang.org/dl](https://golang.org/dl/). Then you can run the following: -``` +```sh git clone https://github.com/rclone/rclone.git cd rclone go build @@ -391,7 +391,7 @@ in the same folder. As an initial check you can now run `./rclone version` Note that on macOS and Windows the [mount](https://rclone.org/commands/rclone_mount/) command will not be available unless you specify an additional build tag `cmount`. -``` +```sh go build -tags cmount ``` @@ -417,7 +417,7 @@ You may add arguments `-ldflags -s` to omit symbol table and debug information, making the executable file smaller, and `-trimpath` to remove references to local file system paths. The official rclone releases are built with both of these. -``` +```sh go build -trimpath -ldflags -s -tags cmount ``` @@ -428,7 +428,7 @@ or `fs.VersionSuffix` (to keep default number but customize the suffix). This can be done from the build command, by adding to the `-ldflags` argument value as shown below. -``` +```sh go build -trimpath -ldflags "-s -X github.com/rclone/rclone/fs.Version=v9.9.9-test" -tags cmount ``` @@ -439,7 +439,7 @@ It generates a Windows resource system object file, with extension .syso, e.g. `resource_windows_amd64.syso`, that will be automatically picked up by future build commands. -``` +```sh go run bin/resource_windows.go ``` @@ -451,7 +451,7 @@ override this version variable in the build command as described above, you need to do that also when generating the resource file, or else it will still use the value from the source. -``` +```sh go run bin/resource_windows.go -version v9.9.9-test ``` @@ -461,13 +461,13 @@ followed by additional commit details, embeds version information binary resourc on Windows, and copies the resulting rclone executable into your GOPATH bin folder (`$(go env GOPATH)/bin`, which corresponds to `~/go/bin/rclone` by default). -``` +```sh make ``` To include mount command on macOS and Windows with Makefile build: -``` +```sh make GOTAGS=cmount ``` @@ -484,7 +484,7 @@ The source will be stored it in the Go module cache, and the resulting executable will be in your GOPATH bin folder (`$(go env GOPATH)/bin`, which corresponds to `~/go/bin/rclone` by default). -``` +```sh go install github.com/rclone/rclone@latest ``` @@ -503,7 +503,7 @@ Instructions 1. `git clone https://github.com/stefangweichinger/ansible-rclone.git` into your local roles-directory 2. add the role to the hosts you want rclone installed to: -``` +```yml - hosts: rclone-hosts roles: - rclone @@ -567,7 +567,7 @@ Rclone has a built-in option `--log-file` for that. Example command to run a sync in background: -``` +```bat c:\rclone\rclone.exe sync c:\files remote:/files --no-console --log-file c:\rclone\logs\sync_files.txt ``` @@ -630,7 +630,7 @@ Example of a PowerShell command that creates a Windows service for mounting some `remote:/files` as drive letter `X:`, for *all* users (service will be running as the local system account): -``` +```pwsh New-Service -Name Rclone -BinaryPathName 'c:\rclone\rclone.exe mount remote:/files X: --config c:\rclone\config\rclone.conf --log-file c:\rclone\logs\mount.txt' ``` diff --git a/docs/content/licence.md b/docs/content/licence.md index 1e2d6458e..48ab0e0a6 100644 --- a/docs/content/licence.md +++ b/docs/content/licence.md @@ -8,7 +8,7 @@ description: "Rclone Licence" This is free software under the terms of the MIT license (check the COPYING file included with the source code). -``` +```text Copyright (C) 2019 by Nick Craig-Wood https://www.craig-wood.com/nick/ Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/docs/content/overview.md b/docs/content/overview.md index c20230f27..12ffe652e 100644 --- a/docs/content/overview.md +++ b/docs/content/overview.md @@ -402,7 +402,7 @@ and to maintain backward compatibility, its behavior has not been changed. To take a specific example, the FTP backend's default encoding is -``` +```sh --ftp-encoding "Slash,Del,Ctl,RightSpace,Dot" ``` @@ -411,13 +411,13 @@ any of the invalid Windows characters in file names. You are backing up Linux servers to this FTP server which do have those characters in file names. So you would add the Windows set which are -``` +```text Slash,LtGt,DoubleQuote,Colon,Question,Asterisk,Pipe,BackSlash,Ctl,RightSpace,RightPeriod,InvalidUtf8,Dot ``` to the existing ones, giving: -``` +```text Slash,LtGt,DoubleQuote,Colon,Question,Asterisk,Pipe,BackSlash,Ctl,RightSpace,RightPeriod,InvalidUtf8,Dot,Del,RightSpace ``` @@ -435,7 +435,7 @@ To avoid this you can change the set of characters rclone should convert for the local filesystem, using command-line argument `--local-encoding`. Rclone's default behavior on Windows corresponds to -``` +```sh --local-encoding "Slash,LtGt,DoubleQuote,Colon,Question,Asterisk,Pipe,BackSlash,Ctl,RightSpace,RightPeriod,InvalidUtf8,Dot" ``` @@ -443,7 +443,7 @@ If you want to use fullwidth characters `:`, `*` and `?` in your filenames without rclone changing them when uploading to a remote, then set the same as the default value but without `Colon,Question,Asterisk`: -``` +```sh --local-encoding "Slash,LtGt,DoubleQuote,Pipe,BackSlash,Ctl,RightSpace,RightPeriod,InvalidUtf8,Dot" ``` diff --git a/docs/content/rc.md b/docs/content/rc.md index ee8ccf484..99fd4e037 100644 --- a/docs/content/rc.md +++ b/docs/content/rc.md @@ -182,7 +182,7 @@ rc` command. You can use it like this: -``` +```sh $ rclone rc rc/noop param1=one param2=two { "param1": "one", @@ -193,14 +193,14 @@ $ rclone rc rc/noop param1=one param2=two If the remote is running on a different URL than the default `http://localhost:5572/`, use the `--url` option to specify it: -``` +```sh rclone rc --url http://some.remote:1234/ rc/noop ``` Or, if the remote is listening on a Unix socket, use the `--unix-socket` option instead: -``` +```sh rclone rc --unix-socket /tmp/rclone.sock rc/noop ``` @@ -213,7 +213,7 @@ remote server. `rclone rc` also supports a `--json` flag which can be used to send more complicated input parameters. -``` +```sh $ rclone rc --json '{ "p1": [1,"2",null,4], "p2": { "a":1, "b":2 } }' rc/noop { "p1": [ @@ -233,13 +233,13 @@ If the parameter being passed is an object then it can be passed as a JSON string rather than using the `--json` flag which simplifies the command line. -``` +```sh rclone rc operations/list fs=/tmp remote=test opt='{"showHash": true}' ``` Rather than -``` +```sh rclone rc operations/list --json '{"fs": "/tmp", "remote": "test", "opt": {"showHash": true}}' ``` @@ -266,7 +266,7 @@ response timing out. Starting a job with the `_async` flag: -``` +```sh $ rclone rc --json '{ "p1": [1,"2",null,4], "p2": { "a":1, "b":2 }, "_async": true }' rc/noop { "jobid": 2 @@ -276,7 +276,7 @@ $ rclone rc --json '{ "p1": [1,"2",null,4], "p2": { "a":1, "b":2 }, "_async": tr Query the status to see if the job has finished. For more information on the meaning of these return parameters see the `job/status` call. -``` +```sh $ rclone rc --json '{ "jobid":2 }' job/status { "duration": 0.000124163, @@ -304,7 +304,7 @@ $ rclone rc --json '{ "jobid":2 }' job/status `job/list` can be used to show the running or recently completed jobs -``` +```sh $ rclone rc job/list { "jobids": [ @@ -321,27 +321,27 @@ duration of an rc call only then pass in the `_config` parameter. This should be in the same format as the `main` key returned by [options/get](#options-get). -``` +```sh rclone rc --loopback options/get blocks=main ``` You can see more help on these options with this command (see [the options blocks section](#option-blocks) for more info). -``` +```sh rclone rc --loopback options/info blocks=main ``` For example, if you wished to run a sync with the `--checksum` parameter, you would pass this parameter in your JSON blob. -``` +```json "_config":{"CheckSum": true} ``` If using `rclone rc` this could be passed as -``` +```sh rclone rc sync/sync ... _config='{"CheckSum": true}' ``` @@ -352,7 +352,7 @@ Note that it is possible to set some values as strings or integers - see [data types](#data-types) for more info. Here is an example setting the equivalent of `--buffer-size` in string or integer format. -``` +```json "_config":{"BufferSize": "42M"} "_config":{"BufferSize": 44040192} ``` @@ -368,32 +368,32 @@ pass in the `_filter` parameter. This should be in the same format as the `filter` key returned by [options/get](#options-get). -``` +```sh rclone rc --loopback options/get blocks=filter ``` You can see more help on these options with this command (see [the options blocks section](#option-blocks) for more info). -``` +```sh rclone rc --loopback options/info blocks=filter ``` For example, if you wished to run a sync with these flags -``` +```sh --max-size 1M --max-age 42s --include "a" --include "b" ``` you would pass this parameter in your JSON blob. -``` +```json "_filter":{"MaxSize":"1M", "IncludeRule":["a","b"], "MaxAge":"42s"} ``` If using `rclone rc` this could be passed as -``` +```sh rclone rc ... _filter='{"MaxSize":"1M", "IncludeRule":["a","b"], "MaxAge":"42s"}' ``` @@ -404,7 +404,7 @@ Note that it is possible to set some values as strings or integers - see [data types](#data-types) for more info. Here is an example setting the equivalent of `--buffer-size` in string or integer format. -``` +```json "_filter":{"MinSize": "42M"} "_filter":{"MinSize": 44040192} ``` @@ -423,7 +423,7 @@ value. This allows caller to group stats under their own name. Stats for specific group can be accessed by passing `group` to `core/stats`: -``` +```sh $ rclone rc --json '{ "group": "job/1" }' core/stats { "speed": 12345 @@ -488,7 +488,7 @@ An example of this might be the `--log-level` flag. Note that the `Name` of the option becomes the command line flag with `_` replaced with `-`. -``` +```json { "Advanced": false, "Default": 5, @@ -547,7 +547,7 @@ isn't specified then it defaults to the root of the remote. For example this JSON is equivalent to `remote:/tmp` -``` +```json { "_name": "remote", "_root": "/tmp" @@ -556,7 +556,7 @@ For example this JSON is equivalent to `remote:/tmp` And this is equivalent to `:sftp,host='example.com':/tmp` -``` +```json { "type": "sftp", "host": "example.com", @@ -566,7 +566,7 @@ And this is equivalent to `:sftp,host='example.com':/tmp` And this is equivalent to `/tmp/dir` -``` +```json { "type": "local", "_root": "/tmp/dir" @@ -2374,7 +2374,7 @@ If an error occurs then there will be an HTTP error status (e.g. 500) and the body of the response will contain a JSON encoded error object, e.g. -``` +```json { "error": "Expecting string value for key \"remote\" (was float64)", "input": { @@ -2400,13 +2400,13 @@ The response to a preflight OPTIONS request will echo the requested "Access-Cont ### Using POST with URL parameters only -``` +```sh curl -X POST 'http://localhost:5572/rc/noop?potato=1&sausage=2' ``` Response -``` +```json { "potato": "1", "sausage": "2" @@ -2415,11 +2415,11 @@ Response Here is what an error response looks like: -``` +```sh curl -X POST 'http://localhost:5572/rc/error?potato=1&sausage=2' ``` -``` +```json { "error": "arbitrary error on input map[potato:1 sausage:2]", "input": { @@ -2431,7 +2431,7 @@ curl -X POST 'http://localhost:5572/rc/error?potato=1&sausage=2' Note that curl doesn't return errors to the shell unless you use the `-f` option -``` +```sh $ curl -f -X POST 'http://localhost:5572/rc/error?potato=1&sausage=2' curl: (22) The requested URL returned error: 400 Bad Request $ echo $? @@ -2440,13 +2440,13 @@ $ echo $? ### Using POST with a form -``` +```sh curl --data "potato=1" --data "sausage=2" http://localhost:5572/rc/noop ``` Response -``` +```json { "potato": "1", "sausage": "2" @@ -2456,13 +2456,13 @@ Response Note that you can combine these with URL parameters too with the POST parameters taking precedence. -``` +```sh curl --data "potato=1" --data "sausage=2" "http://localhost:5572/rc/noop?rutabaga=3&sausage=4" ``` Response -``` +```json { "potato": "1", "rutabaga": "3", @@ -2473,13 +2473,13 @@ Response ### Using POST with a JSON blob -``` +```sh curl -H "Content-Type: application/json" -X POST -d '{"potato":2,"sausage":1}' http://localhost:5572/rc/noop ``` response -``` +```json { "password": "xyz", "username": "xyz" @@ -2489,11 +2489,11 @@ response This can be combined with URL parameters too if required. The JSON blob takes precedence. -``` +```sh curl -H "Content-Type: application/json" -X POST -d '{"potato":2,"sausage":1}' 'http://localhost:5572/rc/noop?rutabaga=3&potato=4' ``` -``` +```json { "potato": 2, "rutabaga": "3", @@ -2512,7 +2512,7 @@ To use these, first [install go](https://golang.org/doc/install). To profile rclone's memory use you can run: -``` +```sh go tool pprof -web http://localhost:5572/debug/pprof/heap ``` @@ -2521,7 +2521,7 @@ memory. You can also use the `-text` flag to produce a textual summary -``` +```sh $ go tool pprof -text http://localhost:5572/debug/pprof/heap Showing nodes accounting for 1537.03kB, 100% of 1537.03kB total flat flat% sum% cum cum% @@ -2546,7 +2546,7 @@ alive which should have been garbage collected. See all active go routines using -``` +```sh curl http://localhost:5572/debug/pprof/goroutine?debug=1 ```