Skip to content

Commit

Permalink
update file task
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkLeong committed Sep 12, 2023
1 parent fa62c65 commit 9e53817
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions service/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,20 @@ func FileOperate(k string) {
os.RemoveAll(temp.To + "/" + lastPath)
}
}
err := os.Rename(v.From, temp.To+"/"+lastPath)
if err != nil {
logger.Error("file move error", zap.Any("err", err))
err = file.MoveFile(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 {
logger.Error("MoveFile error", zap.Any("err", err))
continue
}
logger.Error("file move error", zap.Any("err", err))
err = file.MoveFile(v.From, temp.To+"/"+lastPath)
if err != nil {
logger.Error("MoveFile error", zap.Any("err", err))
continue
}

}
}

} else if temp.Type == "copy" {
err := file.CopyDir(v.From, temp.To, temp.Style)
if err != nil {
Expand Down

0 comments on commit 9e53817

Please sign in to comment.