Sujet : Re: Copy a file from local to network preserving timestamp
De : 186283 (at) *nospam* ud0s4.net (186282@ud0s4.net)
Groupes : comp.os.linux.miscDate : 22. Aug 2024, 05:16:58
Autres entêtes
Organisation : vector apex
Message-ID : <VaecncAcKPEmJlv7nZ2dnZfqnPGdnZ2d@earthlink.com>
References : 1
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0
On 8/21/24 11:25 AM, ambaraba wrote:
I would like to copy a file
from srcdir [local HDD "UUID=5AAAA.. /mnt/srcdir ntfs-3g" in fstab]
to destdir [network share "//192.168.xx.xx /mnt/destdir ... cifs ..." in fstab]
preserving the original creation date.
I've tried
> cp -p /mnt/srcdir/FILE.jpg /mnt/destdir/FILE.jpg
> rsync -vuart /mnt/srcdir /mnt/destdir
> dd ... can't remember the options
I've also tried with "freefilesync"
Unfortunately the timestamp on the destination is not preserved :-(
Is it there a way to
copy a file (many files) from local to network share
preserving timestamp ?
I'm considering "timeshift" but honestly ...
THANKS for any help
"cp -p <whatever> <wherever>" ... preserves time and ownership.
The '-a' "archive" mode can do the same. Experiment
with where/when to add a trailing slash with that one.
I've heard "touch -r" can actually do the same, but
have never used it that way. Probably evokes 'cp -p'.
If using some computer language's libraries to copy
stuff you MAY have to do it in two or three steps -
ie "get time/owner data", "do the copy", "set the
dest file with the original info". I wrote a lot
of backup programs - that oft stored compressed
and/or encrypted copies - and you kinda HAD to
do it this way just to be sure. Not HARD, but a
couple extra steps nevertheless.
Mosty this stuff is much easier with Linux/Unix than
in Winders. TRY to interpret THOSE docs for the Win
'C' library routines :-)