clean trashed directories correctly
This commit is contained in:
parent
6794b3a9b2
commit
3e3b97b2c1
|
@ -149,8 +149,15 @@ func Remove(files []Info) (removed int, err error) {
|
|||
for _, file := range files {
|
||||
log.Infof("removing %s permanently forever!!!", file.name)
|
||||
if err = os.Remove(file.path); err != nil {
|
||||
if i, e := os.Stat(file.path); e == nil && i.IsDir() {
|
||||
err = os.RemoveAll(file.path)
|
||||
if err != nil {
|
||||
return removed, err
|
||||
}
|
||||
} else {
|
||||
return removed, err
|
||||
}
|
||||
}
|
||||
if err = os.Remove(file.trashinfo); err != nil {
|
||||
return removed, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue