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
{{ message }}
Repository navigation
Feature request: copy to tmp file before moving to final file name [SFTP, ...?] #1316
What is your rclone version (eg output from rclone -V)
Which cloud storage system are you using? (eg Google Drive)
SFTP
The command you were trying to run (eg rclone copy /tmp remote:tmp)
rclone copy
When copying via SFTP, rclone copies directly to the file destination. The problem is that if the transfer is aborted, there's no way on the endpoint to know this. Appending a temporary string to the filename, and then changing the filename upon successful upload is a pretty typical way to do this.
Can rclone do this as well?
P.S. I suspect this might only be a problem on SFTP, because when uploading to the cloud, the cloud-based services handle incomplete transactions.
Yes this is a problem with SFTP and the local file system... rsync uses temporary names to get around this problem so rclone should probably adopt that too..
Unfortunately I've encountered data corruption with truncated files as well. Having this option would help determine if it has been caused by aborted writes or not.
Activity
ncw commentedon Apr 10, 2017
Yes this is a problem with SFTP and the local file system... rsync uses temporary names to get around this problem so rclone should probably adopt that too..
ncw commentedon Aug 16, 2020
This is also a problem with FTP as well as SFTP and local.
Rclone should probably have a feature flag on the backend something like HasIncompleteUploads
If this is set then operations.Copy should
if overwriting a file
transfer to new file name
rename over the old file when transfer is complete
delete the partial on errors
if not overwriting
transfer to the existing file name
delete the partial on errors
If this flag is not set then the partial does not need to be deleted (like happens at the moment, which potentially can cause data loss)
Note that the backends may need tweaking as they may delete these partials on error anyway and we should be leaving that to the next layer up.
This will require changing the integration tests too.
Avamander commentedon Oct 12, 2025
Unfortunately I've encountered data corruption with truncated files as well. Having this option would help determine if it has been caused by aborted writes or not.
ncw commentedon Oct 12, 2025
We now have the PartialUploads feature flag
rclone/fs/features.go
Line 38 in 39259a5
This is set for SFTP (and FTP)
rclone/backend/sftp/sftp.go
Line 1186 in 39259a5
This means that uploads will go to a temporary file and be renamed into place unless the --inplace flag is a set .
Since this is already implemented I'm going to close this issue.