mirror of https://github.com/spf13/afero.git
RemoveAll: delete inner files
This commit is contained in:
parent
0c3bf314c5
commit
eb70104e76
|
@ -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
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
RFS, _ := rclonefs.CreateRCFS("pcloud_mv1:cfg")
|
||||
RFS, _ := rclonefs.CreateRCFS("pcloud_mv1:/cfg")
|
||||
|
||||
name := "ycfg"
|
||||
|
||||
|
|
Loading…
Reference in New Issue