本文主要是介绍Rclone文件传输设置禁止分段,不产生partial类型临时文件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
问题
Rclone进行SFTP传输时,遇到大文件(大几十MB)就会出现多次传输.partial后缀的临时文件,根据官方文档,可以添加–inplace参数,让传输只有一次,不分段,好处是接收方判断新增文件不复杂
另外–partial-suffix也能自定义临时文件后缀名
参考官方文档
https://rclone.org/docs/#inplace
机翻
–inplace
在将文件上载到某些后端(设置了PartialUploads功能标志的后端)时,–inplace标志会更改rclone的行为,例如:
local
ftp
sftp
如果没有–inplace(默认值),rclone将首先上传到一个扩展名如下的临时文件,其中XXXXXX表示一个随机字符串,.partial是–partial后缀值(默认值为.partial)。
原始文件名。XXXXXX.部分
(如果需要,rclone将通过截断原始文件名部分来确保最终名称不超过100个字符)。
上传完成后,rclone会将.partial文件重命名为正确的名称,覆盖此时的任何现有文件。如果上传失败,则.partial文件将被删除。
这可以防止后端的其他用户以新名称看到部分上传的文件,并防止在新文件完全上传之前覆盖旧文件。
如果提供了–inplace标志,rclone将直接上传到最终名称,而不创建.partial文件。
这意味着在上传过程中,目录列表中将显示不完整的文件,并且一旦上传开始,任何现有文件都将被覆盖。如果传输失败,则文件将被删除。如果传输失败,这可能会导致现有文件的数据丢失。
请注意,在本地文件系统上,如果不使用就地硬链接(仅限Unix),则会断开。如果你确实使用了–in-place,你将无法更新正在使用的可执行文件。
还要注意的是,在v1.63.0之前的rclone版本的行为就像始终提供–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 and .partial is --partial-suffix value (.partial by default).
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.
这篇关于Rclone文件传输设置禁止分段,不产生partial类型临时文件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!