cp losing file's metadata
If you use man cp
to read the manual page for the copy command you'll find the -p and --preserve
flags.
-p
same as--preserve=mode,ownership,timestamps
and
--preserve[=ATTR_LIST]
preserve the specified attributes (default:mode,ownership,timestamps
), if possible additional attributes:context
,links
,xattr
,all
What this boils down to is that you should use cp -p
instead of just cp
.