initial
This commit is contained in:
24
rclone/list.go
Executable file
24
rclone/list.go
Executable file
@@ -0,0 +1,24 @@
|
||||
package rclone
|
||||
|
||||
import (
|
||||
_ "github.com/ncw/rclone/backend/drive"
|
||||
_ "github.com/ncw/rclone/backend/local"
|
||||
_ "github.com/ncw/rclone/backend/s3"
|
||||
"github.com/ncw/rclone/fs"
|
||||
)
|
||||
|
||||
func (rc *RClone) List(destination string) ([]string, error) {
|
||||
f, err := fs.NewFs(destination)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
entries, err := f.List("")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
names := make([]string, len(entries))
|
||||
for i, entry := range entries {
|
||||
names[i] = entry.Remote()
|
||||
}
|
||||
return names, nil
|
||||
}
|
||||
Reference in New Issue
Block a user