MCPcopy
hub / github.com/rclone/rclone / delete

Method delete

cmd/bisync/resolve.go:334–362  ·  view source on GitHub ↗
(ctx context.Context, thisNamePair namePair, thisPath string, thisFs fs.Fs, thisPathNum int, renameSkipped *bilib.Names)

Source from the content-addressed store, hash-verified

332}
333
334func (b *bisyncRun) delete(ctx context.Context, thisNamePair namePair, thisPath string, thisFs fs.Fs, thisPathNum int, renameSkipped *bilib.Names) (err error) {
335 skip := operations.SkipDestructive(ctx, thisNamePair.oldName, "delete")
336 if !skip {
337 b.indent(fmt.Sprintf("!Path%d", thisPathNum), thisPath+thisNamePair.oldName, fmt.Sprintf("Deleting Path%d copy", thisPathNum))
338 ctx = b.setBackupDir(ctx, thisPathNum)
339 ci := fs.GetConfig(ctx)
340 var backupDir fs.Fs
341 if ci.BackupDir != "" {
342 backupDir, err = operations.BackupDir(ctx, thisFs, thisFs, thisNamePair.oldName)
343 if err != nil {
344 b.critical = true
345 return err
346 }
347 }
348 obj, err := thisFs.NewObject(ctx, thisNamePair.oldName)
349 if err != nil {
350 b.critical = true
351 return err
352 }
353 if err = operations.DeleteFileWithBackupDir(ctx, obj, backupDir); err != nil {
354 err = fmt.Errorf("%s delete failed for %s: %w", thisPath, thisPath+thisNamePair.oldName, err)
355 b.critical = true
356 return err
357 }
358 } else {
359 renameSkipped.Add(thisNamePair.oldName) // (due to dry-run, not equality)
360 }
361 return nil
362}
363
364func (b *bisyncRun) conflictWinner(ds1, ds2 *deltaSet, remote1, remote2 string) int {
365 switch b.opt.ConflictResolve {

Callers 1

resolveMethod · 0.95

Calls 9

indentMethod · 0.95
setBackupDirMethod · 0.95
SkipDestructiveFunction · 0.92
GetConfigFunction · 0.92
BackupDirFunction · 0.92
DeleteFileWithBackupDirFunction · 0.92
NewObjectMethod · 0.65
AddMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected