Files
arlo-cleaner/rclone/del.go
Bel LaPointe be2a031834 initial
2021-03-28 13:12:15 -05:00

32 lines
633 B
Go
Executable File

package rclone
import (
"local/logb"
"local/sandbox/arlo-cleaner/config"
"path"
_ "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) Del(destination string) error {
f, err := fs.NewFs(path.Dir(destination))
if err != nil {
return err
}
obj, err := f.NewObject(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()
}