From a238877ad84e56031ef7f9e855840928bc6d8a28 Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Sat, 30 Oct 2021 00:30:00 +0200 Subject: [PATCH] docs: note that destination is always a directory (#5766) --- docs/content/commands/rclone_copy.md | 36 +++++++++++++++++++--------- docs/content/commands/rclone_move.md | 19 +++++++++++++++ 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/docs/content/commands/rclone_copy.md b/docs/content/commands/rclone_copy.md index 149e1eb23..daf1d8ba8 100644 --- a/docs/content/commands/rclone_copy.md +++ b/docs/content/commands/rclone_copy.md @@ -16,33 +16,47 @@ Copy the source to the destination. Doesn't transfer unchanged files, testing by size and modification time or MD5SUM. Doesn't delete files from the destination. -Note that it is always the contents of the directory that is synced, -not the directory so when source:path is a directory, it's the -contents of source:path that are copied, not the directory name and -contents. +Note that when the source is a directory, it is always the contents +of the directory that is copied, not the directory itself. -If dest:path doesn't exist, it is created and the source:path contents -go there. - -For example +For example, given the following command: rclone copy source:sourcepath dest:destpath -Let's say there are two files in sourcepath +Let's say there are two files in source: sourcepath/one.txt sourcepath/two.txt -This copies them to +The command will copy them to: destpath/one.txt destpath/two.txt -Not to +Not to: destpath/sourcepath/one.txt destpath/sourcepath/two.txt +Also note that the destination is always a directory. If the path +does not exist, it will be created as a directory and the contents of +the source will be copied into it. This is the case even if the source +path points to a file. If you want to copy a single file to a different +name you must use [copyto](commands/rclone_copyto/) instead. + +For example, given the command: + + rclone copy source:sourcepath/one.txt dest:destpath/one.txt + +Rclone will create a directory `dest:destpath/one.txt` and put the source file in there: + + dest:destpath/one.txt/one.txt + +Not copy the single source file as a file with the given destination path, +which would be the result if copyto had been used instead: + + dest:destpath/one.txt + If you are familiar with `rsync`, rclone always works as if you had written a trailing `/` - meaning "copy the contents of this directory". This applies to all commands and whether you are talking about the diff --git a/docs/content/commands/rclone_move.md b/docs/content/commands/rclone_move.md index 0a53c1eea..8eba2368c 100644 --- a/docs/content/commands/rclone_move.md +++ b/docs/content/commands/rclone_move.md @@ -26,6 +26,25 @@ move will be used, otherwise it will copy it (server-side if possible) into `dest:path` then delete the original (if no errors on copy) in `source:path`. +Note that the destination is always a directory. If the path +does not exist, it will be created as a directory and the contents of +the source will be moved into it. This is the case even if the source +path points to a file. If you want to move a single file to a different +name you must use [moveto](commands/rclone_moveto/) instead. + +For example, given the command: + + rclone move source:sourcepath/one.txt dest:destpath/one.txt + +Rclone will create a directory `dest:destpath/one.txt` and put the source file in there: + + dest:destpath/one.txt/one.txt + +Not move the single source file into the given destination path, +which would be the result if moveto had been used instead: + + dest:destpath/one.txt + If you want to delete empty source directories after move, use the --delete-empty-src-dirs flag. See the [--no-traverse](/docs/#no-traverse) option for controlling