diff --git a/scagent/util/fsutil.go b/scagent/util/fsutil.go index 6c6e9d2..7dc1519 100644 --- a/scagent/util/fsutil.go +++ b/scagent/util/fsutil.go @@ -14,7 +14,6 @@ import ( "path/filepath" "scagent/config" "strings" - "time" "github.com/schollz/progressbar/v3" "go.uber.org/zap" @@ -304,16 +303,6 @@ func DecompressZip(zpFname string, dirpath string) error { return fmt.Errorf("failed to open file in zip (%v)", err) } defer fileInArchive.Close() - // 检查文件是否存在,存在的话先备份 - if _, err := os.Stat(filePath); err == nil { - // 当前时间 - currentTime := time.Now().Format("20060102_150405") - // 备份文件 - backupPath := filePath + currentTime + "_bak" - if err := os.Rename(filePath, backupPath); err != nil { - return fmt.Errorf("failed to backup file (%v)", err) - } - } // 复制文件到目标路径 if _, err := io.Copy(dstFile, fileInArchive); err != nil { return fmt.Errorf("failed to copy file in zip (%v)", err)