Re: Copy a file from local to network preserving timestamp

Liste des GroupesRevenir à col misc 
Sujet : Re: Copy a file from local to network preserving timestamp
De : vallor (at) *nospam* cultnix.org (vallor)
Groupes : comp.os.linux.misc
Date : 22. Aug 2024, 08:09:12
Autres entêtes
Message-ID : <lio6gnFc4mtU7@mid.individual.net>
References : 1 2
User-Agent : Pan/0.160 (Toresk; b2470fe; Linux-6.11.0-rc4)
On Thu, 22 Aug 2024 05:32:04 -0000 (UTC), Lawrence D'Oliveiro
<ldo@nz.invalid> wrote in <va6igk$a1bk$1@dont-email.me>:

On Wed, 21 Aug 2024 17:25:52 +0200, ambaraba wrote:
 
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 :-(
 
cp and rsync should work. You can verify this by trying your same
commands between local volumes.
 
The fact that the commands don’t work on the file server sounds like the
fault of the file server.

Or the file server protocol, or even the API available to cp(1).

The OP was about the "creation time", which is supported in
the Linux statx(2) call in the statx struct as
[...]
struct statx_timestamp stx_btime;  /* Creation */
[...]

The ext4 filesystem supports this, and you can see it if you run
stat(1) on a file:
# stat /etc/fstab
  File: /etc/fstab
  Size: 1100      Blocks: 8          IO Block: 4096   regular file
Device: 10306h/66310d Inode: 7602178     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2024-08-21 22:00:01.907146964 -0700
Modify: 2024-07-23 20:59:27.235228009 -0700
Change: 2024-07-23 20:59:27.235228009 -0700
 Birth: 2023-10-12 05:05:55.902131998 -0700

"Birth" is the creation date.  I don't think cp(1)
duplicates that for a new file.  (And it wouldn't
make sense anyway, because it would be the "birth" of
a new file.)

You'll also note that utime(2) and utimes(2) only allow
setting the access and modification times on a file.  Please
correct me if I'm wrong, but I don't see a way to change
change time or birth time on a file.

--
-v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti
   OS: Linux 6.11.0-rc4 Release: Mint 21.3 Mem: 258G
   "The future isn't what it used to be."

Date Sujet#  Auteur
9 Jul 25 o 

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal