What is the problem you are having with rclone?
Currently i create some wrapper around some of rclone func instead of using command line
But i notice some func should need set current working directory to avoid error
so how can I set current working directory when using rclone func
Which cloud storage system are you using? (eg Google Drive)
None using local
Here is the sample wrapper around lsd func of rclone
func Lsd(ctx context.Context, remotePath string, excludeFrom []string) (string, error) {
var buf bytes.Buffer
var output string
newFilterOptions := filter.Opt{
MinAge: fs.DurationOff,
MaxAge: fs.DurationOff,
MinSize: fs.SizeSuffix(-1),
MaxSize: fs.SizeSuffix(-1),
RulesOpt: filter.RulesOpt{
ExcludeFrom: excludeFrom,
},
}
newFilter, err := filter.NewFilter(&newFilterOptions)
if err != nil {
return "", fmt.Errorf("error create filter : %w", err)
}
ctx = filter.ReplaceConfig(ctx, newFilter)
fsrc := cmd.NewFsSrc([]string{remotePath})
err = operations.ListDir(ctx, fsrc, &buf)
if err != nil {
return "", err
}
// Access the captured output in the buffer
output = buf.String()
return output, nil
}
Thanks