32 lines
685 B
Go
Executable File
32 lines
685 B
Go
Executable File
package rclone
|
|
|
|
import (
|
|
"local/logb"
|
|
"local/sandbox/arlo-cleaner/config"
|
|
"path"
|
|
|
|
_ "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) Del(destination string) error {
|
|
f, err := fs.NewFs(rc.Context(), path.Dir(destination))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
obj, err := f.NewObject(rc.Context(), path.Base(destination))
|
|
if err == fs.ErrorObjectNotFound {
|
|
return nil
|
|
} else if err != nil {
|
|
return err
|
|
}
|
|
if config.DryRun {
|
|
logb.Infof("del", obj)
|
|
//return nil TODO
|
|
}
|
|
logb.Infof("removing %v", destination)
|
|
return obj.Remove(rc.Context())
|
|
}
|