update file task

This commit is contained in:
LinkLeong 2023-09-12 09:16:18 +01:00
parent fa62c65526
commit 9e5381710f

View file

@ -102,7 +102,9 @@ func FileOperate(k string) {
os.RemoveAll(temp.To + "/" + lastPath) os.RemoveAll(temp.To + "/" + lastPath)
} }
} }
err := os.Rename(v.From, temp.To+"/"+lastPath) err := file.CopyDir(v.From, temp.To, temp.Style)
if err == nil {
err = os.RemoveAll(v.From)
if err != nil { if err != nil {
logger.Error("file move error", zap.Any("err", err)) logger.Error("file move error", zap.Any("err", err))
err = file.MoveFile(v.From, temp.To+"/"+lastPath) err = file.MoveFile(v.From, temp.To+"/"+lastPath)
@ -112,6 +114,8 @@ func FileOperate(k string) {
} }
} }
}
} else if temp.Type == "copy" { } else if temp.Type == "copy" {
err := file.CopyDir(v.From, temp.To, temp.Style) err := file.CopyDir(v.From, temp.To, temp.Style)
if err != nil { if err != nil {