Skip to content

Commit

Permalink
Fix backup of a single file
Browse files Browse the repository at this point in the history
  • Loading branch information
Biptaste committed Jul 13, 2022
1 parent 3c9928d commit 800d519
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions actions/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func BackupActionHandler(ctx domain.ExecutionContext, backupFilesOpt *bool, back

// prepare a walk function to handle the whole hierarchy
walkFunc := func(filepath string, info os.FileInfo, err error) error {
if err != nil {
return fmt.Errorf("%s file or directory not found \n%s\n", filepath, err)
}
target := path.Join(filesDir, filepath)

// just create the directory
Expand All @@ -94,15 +97,6 @@ func BackupActionHandler(ctx domain.ExecutionContext, backupFilesOpt *bool, back
}

for _, file := range config.Get().BackupConfig.Files {
fmt.Println(file)
fileInfo, err := os.Stat(file)
if err != nil {
return fmt.Errorf("%s file or directory not found \n%s\n", file, err)
}
if !fileInfo.IsDir() {
return fmt.Errorf("%s is not a directory \n", file)
}

err = filepath.Walk(file, walkFunc)
if err != nil {
return fmt.Errorf("Unable to walk into %s\n%s\n", file, err)
Expand Down

0 comments on commit 800d519

Please sign in to comment.