[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: unexpected behavior of cp and mv



On Wed, 29 Apr 2020 12:22:41 -0400
Alberto Sentieri <22t@tripolho.com> wrote:

> cp and mv are not preserving the file timestamps when copying from a 
> ext4 file system to a smb file system.

What I see is:

* mv does preserve the time of the file, regardless of copying to an
  SMB share or not.

* cp indeed does not preserve the time of the original file, regardless
  of copying to an SMB share or not.

mv simply moves a directory entry, including the inode, from here to
there. cp creates a new directory entry at the destination. So these
results make sense.

To have cp preserve the time (i.e. copy the original file's time to the
copy), use its -p option.

Also, check for aliases that might include options you don't want.

-- 
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/


Reply to: