Skip to content

Commit

Permalink
fix: don't delete disabled project older files (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeessy2 committed Jun 19, 2023
1 parent e87e61c commit ef1693a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/delete_old_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package client
import (
"backup-x/entity"
"backup-x/util"
"io/ioutil"
"log"
"os"
"time"
Expand All @@ -22,7 +21,8 @@ func DeleteOldBackup() {
}

for _, backupConf := range conf.BackupConfig {
if !backupConf.NotEmptyProject() {
// empty project and disabeld
if !backupConf.NotEmptyProject() || backupConf.Enabled == 1 {
continue
}
// 删除本地的过时文件
Expand All @@ -37,7 +37,7 @@ func DeleteOldBackup() {

// deleteLocalOlderFiles 删除本地的过时文件
func deleteLocalOlderFiles(backupConf entity.BackupConfig) {
backupFiles, err := ioutil.ReadDir(backupConf.GetProjectPath())
backupFiles, err := os.ReadDir(backupConf.GetProjectPath())
if err != nil {
log.Printf("读取项目 %s 的本地目录失败! ERR: %s\n", backupConf.ProjectName, err)
}
Expand Down

0 comments on commit ef1693a

Please sign in to comment.