RemoveAll: delete inner files

This commit is contained in:
mkvolkov 2022-08-20 12:16:05 +03:00
parent 0c3bf314c5
commit eb70104e76
2 changed files with 13 additions and 2 deletions

View File

@ -108,7 +108,18 @@ func (rcfs *RCFS) Remove(name string) error {
func (rcfs *RCFS) RemoveAll(path string) error {
path = rcfs.AbsPath(path)
afero.Walk(rcfs, path, printNode)
afero.Walk(rcfs, path, func(path string, info fs.FileInfo, err error) error {
if err != nil {
return err
}
if info.IsDir() {
return nil
} else {
rcfs.Remove(path)
return nil
}
})
return nil
}

View File

@ -9,7 +9,7 @@ import (
)
func main() {
RFS, _ := rclonefs.CreateRCFS("pcloud_mv1:cfg")
RFS, _ := rclonefs.CreateRCFS("pcloud_mv1:/cfg")
name := "ycfg"