1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-06 10:33:34 +00:00

Factor server side move detection

This commit is contained in:
ncw
2017-01-10 20:03:55 +00:00
committed by Nick Craig-Wood
parent aa62e93094
commit 4aae7bcca6
3 changed files with 15 additions and 9 deletions

View File

@@ -385,6 +385,17 @@ func Move(fdst Fs, dst Object, remote string, src Object) (err error) {
return DeleteFile(src)
}
// CanServerSideMove returns true if fdst support server side moves or
// server side copies
//
// Some remotes simulate rename by server-side copy and delete, so include
// remotes that implements either Mover or Copier.
func CanServerSideMove(fdst Fs) bool {
_, canMove := fdst.(Mover)
_, canCopy := fdst.(Copier)
return canMove || canCopy
}
// DeleteFile deletes a single file respecting --dry-run and accumulating stats and errors.
func DeleteFile(dst Object) (err error) {
if Config.DryRun {