Implement --suffix for use with --backup-dir only #98

This also makes sure we remove files we are about to override in the
--backup-dir properly.
This commit is contained in:
Nick Craig-Wood
2017-01-19 20:11:17 +00:00
parent a77659e47d
commit e2bf9eb8e9
5 changed files with 66 additions and 15 deletions
+3 -1
View File
@@ -413,7 +413,9 @@ func deleteFileWithBackupDir(dst Object, backupDir Fs) (err error) {
if !SameConfig(dst.Fs(), backupDir) {
err = errors.New("parameter to --backup-dir has to be on the same remote as destination")
} else {
err = Move(backupDir, nil, dst.Remote(), dst)
remoteWithSuffix := dst.Remote() + Config.Suffix
overwritten, _ := backupDir.NewObject(remoteWithSuffix)
err = Move(backupDir, overwritten, remoteWithSuffix, dst)
}
} else {
err = dst.Remove()