Discussione:
cp -p not preserving timestamp
(troppo vecchio per rispondere)
ambaraba
2024-08-21 08:13:55 UTC
Permalink
I would like to cp a file created in 2002 (linux mint 21.2)
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 (2002)

cp -p /mnt/srcdir/FILE.jpg /mnt/destdir/FILE.jpg

Unfortunately the timestamp on the destination is not preserved (it is
TODAY !)
For sure I'm doing something wrong ... but cannot find where and what
THANKS for any help !
P.S.
cp -p /mnt/srcdir/FILE.jpg /mnt/srcdir/FILE_COPIED.jpg
/mnt/srcdir/FILE_COPIED.jpg mantains the original timestamp
<grr>

boring details :
source: ll /mnt/srcdir/FILE.jpg
-rwxrwxrwx 1 MYSELF MYSELF 262958 Jun 8 2002 /mnt/srcdir/FILE.jpg*
dest: ll /mnt/destdir/FILE.jpg
-rwxrwxrwx 1 MYSELF MYSELF 262958 Aug 21 08:44 /mnt/destdir/FILE.jpg*
and : stat /mnt/destdir/FILE.jpg
File: /mnt/destdir/FILE.jpg
Size: 262958 Blocks: 520 IO Block: 1048576 regular file
Device: 35h/53d Inode: 81137270 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 1000/ MYSELF) Gid: ( 1000/
MYSELF)
Access: 2024-08-21 08:44:09.535219100 +0200
Modify: 2024-08-21 08:44:07.395050200 +0200
Change: 2024-08-21 08:44:07.395050200 +0200
Birth: 2024-08-21 08:44:06.375153700 +0200
sm
2024-08-21 10:31:53 UTC
Permalink
Post by ambaraba
I would like to cp a file created in 2002 (linux mint 21.2)
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 (2002)
cp -p /mnt/srcdir/FILE.jpg /mnt/destdir/FILE.jpg
Unfortunately the timestamp on the destination is not preserved (it is
TODAY !)
You are copying to a remote folder and the command has no ability to
manipulate the destination timestamp. That's the problem.
ambaraba
2024-08-21 15:14:25 UTC
Permalink
Post by sm
You are copying to a remote folder and the command has no ability to
manipulate the destination timestamp. That's the problem.
Se possiamo continuare in italiano chiedo:
Come copiare da disco locale a share di rete un file mantenendo il
timestamp originale ?
Ho provato "dd" e "rsync -vuart" ma in entrambi i casi la data e' quella
odierna.
Idem usando "freefilesync" :-(
Comunque : *grazie* x l'attenzione :-)
sm
2024-08-21 15:44:04 UTC
Permalink
Post by ambaraba
Post by sm
You are copying to a remote folder and the command has no ability to
manipulate the destination timestamp. That's the problem.
Come copiare da disco locale a share di rete un file mantenendo il
timestamp originale ?
Ho provato "dd" e "rsync -vuart" ma in entrambi i casi la data e' quella
odierna.
Idem usando "freefilesync" :-(
Comunque : *grazie* x l'attenzione :-)
Temo che il problema sia cifs. Anzi certamente è lui, ma non so dirti se
c'è soluzione.
Valerio Vanni
2024-08-21 21:54:50 UTC
Permalink
Post by ambaraba
Post by sm
You are copying to a remote folder and the command has no ability to
manipulate the destination timestamp. That's the problem.
Dato che siamo su un gruppo it.*, la cosa strana è il primo messaggio
in inglese.
Post by ambaraba
Come copiare da disco locale a share di rete un file mantenendo il
timestamp originale ?
Ho provato "dd" e "rsync -vuart" ma in entrambi i casi la data e' quella
odierna.
Probabilmente è il server cifs che fa orecchie da mercante.
Facendo una ricerca, vedo che ci sono stati diversi cambi di rotta
nelle versioni di Samba.

Potresti provare a approfondire sulla versione che usi lato server.
--
Ci sono 10 tipi di persone al mondo: quelle che capiscono il sistema binario
e quelle che non lo capiscono.
ambaraba
2024-08-21 14:51:28 UTC
Permalink
Post by ambaraba
I would like to cp a file created in 2002 (linux mint 21.2)
Oh mmmm##### sbagliato newsgroup !
sorry
Piergiorgio Sartor
2024-08-21 17:40:59 UTC
Permalink
Post by ambaraba
I would like to cp a file created in 2002 (linux mint 21.2)
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 (2002)
cp -p /mnt/srcdir/FILE.jpg /mnt/destdir/FILE.jpg
Unfortunately the timestamp on the destination is not preserved (it is
TODAY !)
For sure I'm doing something wrong ... but cannot find where and what
THANKS for any help !
P.S.
cp -p /mnt/srcdir/FILE.jpg /mnt/srcdir/FILE_COPIED.jpg
/mnt/srcdir/FILE_COPIED.jpg mantains the original timestamp
<grr>
source: ll /mnt/srcdir/FILE.jpg
-rwxrwxrwx 1 MYSELF MYSELF 262958 Jun  8  2002 /mnt/srcdir/FILE.jpg*
dest: ll /mnt/destdir/FILE.jpg
-rwxrwxrwx 1 MYSELF MYSELF 262958 Aug 21 08:44 /mnt/destdir/FILE.jpg*
and : stat  /mnt/destdir/FILE.jpg
  File: /mnt/destdir/FILE.jpg
  Size: 262958        Blocks: 520        IO Block: 1048576 regular file
Device: 35h/53d    Inode: 81137270    Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/      MYSELF)   Gid: ( 1000/ MYSELF)
Access: 2024-08-21 08:44:09.535219100 +0200
Modify: 2024-08-21 08:44:07.395050200 +0200
Change: 2024-08-21 08:44:07.395050200 +0200
 Birth: 2024-08-21 08:44:06.375153700 +0200
In Inglese?

Ad ogni modo, non dipende, come gia` scritto,
da "cp" solamente.

Se hai, per esempio, un filesystem *senza*
timestamp, come farebbe "cp" a mantenerli?

bye,
--
piergiorgio
Continua a leggere su narkive:
Loading...