add key if not present

This commit is contained in:
2021-04-12 00:02:35 +02:00
parent 19e75c1dad
commit 03ca0c8677
5 changed files with 91 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ package internal
import (
"bytes"
"fmt"
"io"
"os"
"os/exec"
)
@@ -46,3 +47,22 @@ func ExecuteResticCommand(options ExecuteOptions, args ...string) (string, error
options.Command = "restic"
return ExecuteCommand(options, args...)
}
func CopyFile(from, to string) error {
original, err := os.Open("original.txt")
if err != nil {
return nil
}
defer original.Close()
new, err := os.Create("new.txt")
if err != nil {
return nil
}
defer new.Close()
if _, err := io.Copy(new, original); err != nil {
return err
}
return nil
}