How to init Rclone


I am trying to invoke RClone commands programmatically by using a pre-defined config file. `
Using below sample function

    func Copy(source string, destination string) (fs.Fs, string) {
    	fsrc, srcFileName, fdst := cmd.NewFsSrcFileDst([]string{source, destination})
    	fmt.Println(fsrc, srcFileName, fdst)
    	if srcFileName == "" {
    		return sync.CopyDir(fdst, fsrc)
    	return operations.CopyFile(fdst, fsrc, srcFileName, srcFileName)

gives me following error:
didn't find backend called "local"

I couldn’t figure out how RClone initializes all the backends.

You need to import the backends you want to use, or all of them - see the main file.

So for example this little script works…

package main

import (

	_ ""

func main() {
	f, err := fs.NewFs("drive:")
	if err != nil {
	entries, err := f.List("")
	if err != nil {
1 Like

Thanks @ncw. This worked.

1 Like