Lsd (list file) on drive - using on go lang (librclone)

Hi, Im new here,

I'm trying to use rclone on my go code and I'm just find one way to use rclone in my code is librclone
and i copy file from my local to google drive and its worked

librclone.Initialize()
	defer librclone.Finalize()
	syncRequest := struct {
		SrcFs string `json:"srcFs"`
		DstFs string `json:"dstFs"`
	}{
		SrcFs: "./deneme",
		DstFs: "gDrive:denemeDrive/",
	}

	syncRequestJSON, err := json.Marshal(syncRequest)
	if err != nil {
		fmt.Println(err)
		return
	}

	out, status := librclone.RPC("sync/copy", string(syncRequestJSON))
	fmt.Printf("Got status: %d and output: %q\n", status, out)

but i wanna list my folder in my drive
on command its rclone lsd gDrive: but in go lang
I'm not find method for lsd (list file)

not: Is there a document somewhere with all the methods?

I think you want operations/list.

If you want only directories and no files (like lsd), then be sure to include:

"dirsOnly": true

If you are marshaling JSON from a Go struct, try something like:

DirsOnly      bool     `json:"dirsOnly,omitempty"`

Yes:

thanks, its worked
How can I set the config file in code?

1 Like
1 Like