diff --git a/copy.go b/copy.go index 67ccc5f..092d68a 100644 --- a/copy.go +++ b/copy.go @@ -5,6 +5,7 @@ Copied from https://github.com/otiai10/copy and slightly altered. The MIT License (MIT) +Copyright (c) 2019 Alexander Weinhold Copyright (c) 2018 otiai10 Permission is hereby granted, free of charge, to any person obtaining a copy @@ -31,6 +32,7 @@ import ( "io/ioutil" "os" "path/filepath" + "time" ) // Copy copies src to dest, doesn't matter if src is a directory or a file @@ -64,6 +66,9 @@ func filecopy(src, dest string, info os.FileInfo) error { if err = os.Chmod(f.Name(), info.Mode()); err != nil { return err } + if err = os.Chtimes(f.Name(), time.Now().Local(), info.ModTime()); err != nil { + return err + } s, err := os.Open(src) if err != nil { return err