initial
This commit is contained in:
31
rclone/del.go
Executable file
31
rclone/del.go
Executable file
@@ -0,0 +1,31 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user