Deutsch   English   Français   Italiano  
<7gdmpkx4rk.ln2@Telcontar.valinor>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!npeer.as286.net!npeer-ng0.as286.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: "Carlos E.R." <robin_listas@es.invalid>
Newsgroups: comp.os.linux.misc
Subject: Re: Copy a file from local to network preserving timestamp
Date: Fri, 23 Aug 2024 14:56:07 +0200
Lines: 99
Message-ID: <7gdmpkx4rk.ln2@Telcontar.valinor>
References: <va50u0$3tav1$3@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net bMFy9IdwSQioGZ7zCFCxHgp/mu88fD2dQyRxPB98fBI4AalL6s
X-Orig-Path: Telcontar.valinor!not-for-mail
Cancel-Lock: sha1:X/3p49A0FHJulr7cZ71LyR6bmMk= sha256:XCImSXi78bGd9CTTGmjPQf5BLli/nbIrrx5iTaj2ItQ=
User-Agent: Mozilla Thunderbird
Content-Language: es-ES, en-CA
In-Reply-To: <va50u0$3tav1$3@dont-email.me>
Bytes: 4236

On 2024-08-21 17:25, 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

You have to consider that Linux uses three timestamps, but FAT/NTFS 
volumes don't.

I just ran a test, using an external usb memory stick formatted FAT. The 
time stamp is kept if I use "cp -a":

cer@Telcontar:~> l p
-rw-r--r-- 1 cer users 140 May 25 14:14 p
cer@Telcontar:~> cp p /media/D80B-80D3/
cer@Telcontar:~> l /media/D80B-80D3/p
-rw-r--r-- 1 cer users 140 Aug 23 14:42 /media/D80B-80D3/p
cer@Telcontar:~>

cer@Telcontar:~> stat /media/D80B-80D3/p
   File: /media/D80B-80D3/p
   Size: 140       	Blocks: 64         IO Block: 32768  regular file
Device: 841h/2113d	Inode: 2576        Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/     cer)   Gid: (  100/   users)
Access: 2019-08-04 02:00:00.000000000 +0200
Modify: 2024-08-23 14:42:54.000000000 +0200
Change: 2024-08-23 14:42:54.980000000 +0200
  Birth: -
cer@Telcontar:~>


You see that it is not kept with plain "cp". But:

cer@Telcontar:~> rm /media/D80B-80D3/p
cer@Telcontar:~> cp -a p /media/D80B-80D3/
cer@Telcontar:~> l /media/D80B-80D3/p
-rw-r--r-- 1 cer users 140 May 25 14:14 /media/D80B-80D3/p
cer@Telcontar:~> stat /media/D80B-80D3/p
   File: /media/D80B-80D3/p
   Size: 140       	Blocks: 64         IO Block: 32768  regular file
Device: 841h/2113d	Inode: 2582        Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/     cer)   Gid: (  100/   users)
Access: 2024-08-23 02:00:00.000000000 +0200
Modify: 2024-05-25 14:14:42.000000000 +0200
Change: 2024-08-23 14:44:07.900000000 +0200
  Birth: -
cer@Telcontar:~>


Let's have a look at a random file on the stick:

cer@Telcontar:~> stat /media/D80B-80D3/elements.txt
   File: /media/D80B-80D3/elements.txt
   Size: 117       	Blocks: 64         IO Block: 32768  regular file
Device: 841h/2113d	Inode: 2575        Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/     cer)   Gid: (  100/   users)
Access: 2024-08-23 02:00:00.000000000 +0200
Modify: 2018-12-17 19:53:36.000000000 +0100
Change: 2018-12-17 20:23:51.000000000 +0100
  Birth: -
cer@Telcontar:~>


The "Access" timestamp is the same in both files, so it is not true.



cer@Telcontar:~> l p
-rw-r--r-- 1 cer users 140 May 25 14:14 p
cer@Telcontar:~> stat p
   File: p
   Size: 140       	Blocks: 8          IO Block: 4096   regular file
Device: 825h/2085d	Inode: 2901704     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/     cer)   Gid: (  100/   users)
Access: 2024-08-23 14:42:54.982156242 +0200
Modify: 2024-05-25 14:14:42.845777574 +0200
Change: 2024-05-25 14:14:42.845777574 +0200
  Birth: 2024-05-25 14:14:42.845777574 +0200
cer@Telcontar:~>





-- 
Cheers, Carlos.