preserve mtime when copying files (#1026)
* make it possible to preserve mtime and atime when copying files Preserving other attributes like ownership, ctime or btime of a file is desired but currently not possible to implement in a portable way with go. Fixes #869 Relates to #779 * FIXUP use cp-compatible default for not-preserving mode
This commit is contained in:
1 parent
24bba6288d
commit
fdb320d30c
7 files changed
+76
-13
No files matched your search
@@ -499,6 +499,21 @@ func (e *setExpr) eval(app *app, args []string) {
|
||||
}
|
||||
}
|
||||
gOpts.ruler = toks
|
||||
case "preserve":
|
||||
if e.val == "" {
|
||||
gOpts.preserve = nil
|
||||
return
|
||||
}
|
||||
toks := strings.Split(e.val, ":")
|
||||
for _,s := range toks {
|
||||
switch s {
|
||||
case "mode", "timestamps":
|
||||
default:
|
||||
app.ui.echoerr("preserve: should consist of 'mode' or 'timestamps separated with colon")
|
||||
return
|
||||
}
|
||||
}
|
||||
gOpts.preserve = toks
|
||||
case "infotimefmtnew":
|
||||
gOpts.infotimefmtnew = e.val
|
||||
case "infotimefmtold":
|
||||
|
||||
Reference in new issue
Block a user