Does cp -r preserve directory timestamp or does it restamp with current date/time? Using GUI didn't preserve (was using Ubuntu 16.04.8 lxde desktop). Now I've started using tar to compress then extract with preserve timestamps switch
I just tried it out and no, apparently it doesn't.
EDIT: man cp and a quick search for timestamp reveals that when copy is called with the -p option, it should preserve timestamps. Not sure if this is a GNU thing though, but even busybox seems to support his flag.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Does cp -r preserve directory timestamp or does it restamp with current date/time? Using GUI didn't preserve (was using Ubuntu 16.04.8 lxde desktop). Now I've started using tar to compress then extract with preserve timestamps switch
That is a question I do not know the answer to
A unix and linux forum had the answer (unix.stackexchange.com/questions/4...
cp -r --preserve=timestamps SOURCE DESTINATION
No need to tar compress then tar extract with preserve time stamp switch.
I tested the above 'cp -r --preserve=timestamps SOURCE DESTINATION' command and it works like a dream.
You also can use
rsync
I just tried it out and no, apparently it doesn't.
EDIT:
man cp
and a quick search fortimestamp
reveals that when copy is called with the-p
option, it should preserve timestamps. Not sure if this is a GNU thing though, but even busybox seems to support his flag.