cp -p should work fine for copying the file without changing timestamp or permissions, can you show us an example of it failing to do so? What operating system are you on?
You can't change a file without altering a timestamp, however you can change the timestamp back to what it was manually using the touch command.
cp -p will keep the timestamp of the file being copied. But i want it the other way round
-rwxr-xr-x 1 XXX XXX 243 Apr 1 16:29 sum.sh
Lets say the above file is already in place and i want to overwrite it with the following file
-rwxr-xr-x 1 XXX XXX 243 Apr 2 00:29 sum.sh
Which is basically newer version of it, how can i change it retaining the original timestamp.. in this case 16:29.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.