mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2025-09-08 03:20:39 +00:00
add key if not present
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user