Created
March 8, 2024 13:00
-
-
Save jumoog/ecbfc913cc2d5033597c20357d6532da to your computer and use it in GitHub Desktop.
rclone move srcPath destPath --ignore-checksum --delete-empty-src-dirs --ignore-existing --quiet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
// add the backend that you need | |
_ "github.com/rclone/rclone/backend/local" | |
"github.com/rclone/rclone/cmd" | |
"github.com/rclone/rclone/fs" | |
"github.com/rclone/rclone/fs/sync" | |
) | |
// same function like | |
// rclone move srcPath destPath --ignore-checksum --delete-empty-src-dirs --ignore-existing --quiet | |
func (app *application) rclone(src, dst string) error { | |
ctx := context.Background() | |
ctx, ci := fs.AddConfig(ctx) | |
ci.IgnoreExisting = true | |
ci.IgnoreChecksum = true | |
fsrc, srcFileName, fdst := cmd.NewFsSrcFileDst([]string{src, dst}) | |
if srcFileName == "" { | |
// Perform the move operation | |
return sync.MoveDir(ctx, fdst, fsrc, true, false) | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment