25 lines
540 B
Go
Executable File
25 lines
540 B
Go
Executable File
package rclone
|
|
|
|
import (
|
|
_ "github.com/rclone/rclone/backend/drive"
|
|
_ "github.com/rclone/rclone/backend/local"
|
|
_ "github.com/rclone/rclone/backend/s3"
|
|
"github.com/rclone/rclone/fs"
|
|
)
|
|
|
|
func (rc *RClone) List(destination string) ([]string, error) {
|
|
f, err := fs.NewFs(rc.Context(), destination)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
entries, err := f.List(rc.Context(), "")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
names := make([]string, len(entries))
|
|
for i, entry := range entries {
|
|
names[i] = entry.Remote()
|
|
}
|
|
return names, nil
|
|
}
|