Add RmdirP
This commit is contained in:
parent
5cf25089da
commit
9baa4dbc17
16
path.go
Normal file
16
path.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package ch
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RmdirP(path string) error {
|
||||||
|
err := os.Remove(path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dir, _ := filepath.Split(path)
|
||||||
|
_ = RmdirP(dir) // We only care about errors for the first directory we always expect atleast one to fail
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user