mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
operations: implement uploads to temp name with --inplace to disable
When copying to a backend which has the PartialUploads feature flag set and can Move files the file is copied into a temporary name first. Once the copy is complete, the file is renamed to the real destination. This prevents other processes from seeing partially downloaded copies of files being downloaded and prevents overwriting the old file until the new one is complete. This also adds --inplace flag that can be used to disable the partial file copy/rename feature. See #3770 Co-authored-by: Nick Craig-Wood <nick@craig-wood.com>
This commit is contained in:
committed by
Nick Craig-Wood
parent
cc01223535
commit
5c594fea90
@@ -1257,6 +1257,49 @@ This can be useful as an additional layer of protection for immutable
|
||||
or append-only data sets (notably backup archives), where modification
|
||||
implies corruption and should not be propagated.
|
||||
|
||||
### --inplace {#inplace}
|
||||
|
||||
The `--inplace` flag changes the behaviour of rclone when uploading
|
||||
files to some backends (backends with the `PartialUploads` feature
|
||||
flag set) such as:
|
||||
|
||||
- local
|
||||
- ftp
|
||||
- sftp
|
||||
|
||||
Without `--inplace` (the default) rclone will first upload to a
|
||||
temporary file with an extension like this where `XXXXXX` represents a
|
||||
random string.
|
||||
|
||||
original-file-name.XXXXXX.partial
|
||||
|
||||
(rclone will make sure the final name is no longer than 100 characters
|
||||
by truncating the `original-file-name` part if necessary).
|
||||
|
||||
When the upload is complete, rclone will rename the `.partial` file to
|
||||
the correct name, overwriting any existing file at that point. If the
|
||||
upload fails then the `.partial` file will be deleted.
|
||||
|
||||
This prevents other users of the backend from seeing partially
|
||||
uploaded files in their new names and prevents overwriting the old
|
||||
file until the new one is completely uploaded.
|
||||
|
||||
If the `--inplace` flag is supplied, rclone will upload directly to
|
||||
the final name without creating a `.partial` file.
|
||||
|
||||
This means that an incomplete file will be visible in the directory
|
||||
listings while the upload is in progress and any existing files will
|
||||
be overwritten as soon as the upload starts. If the transfer fails
|
||||
then the file will be deleted. This can cause data loss of the
|
||||
existing file if the transfer fails.
|
||||
|
||||
Note that on the local file system if you don't use `--inplace` hard
|
||||
links (Unix only) will be broken. And if you do use `--inplace` you
|
||||
won't be able to update in use executables.
|
||||
|
||||
Note also that versions of rclone prior to v1.63.0 behave as if the
|
||||
`--inplace` flag is always supplied.
|
||||
|
||||
### -i, --interactive {#interactive}
|
||||
|
||||
This flag can be used to tell rclone that you wish a manual
|
||||
|
||||
Reference in New Issue
Block a user