Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You will be run over by a beer truck.


comp / comp.os.linux.misc / Re: Copy a file from local to network preserving timestamp

SubjectAuthor
* Copy a file from local to network preserving timestampambaraba
+- Re: Copy a file from local to network preserving timestampCarlos E.R.
+* Re: Copy a file from local to network preserving timestampLawrence D'Oliveiro
|`- Re: Copy a file from local to network preserving timestampvallor
+- Re: Copy a file from local to network preserving timestamp186282@ud0s4.net
+* Re: Copy a file from local to network preserving timestampLew Pitcher
|`- Re: Copy a file from local to network preserving timestampambaraba
`- Re: Copy a file from local to network preserving timestampThe Natural Philosopher

1
Subject: Copy a file from local to network preserving timestamp
From: ambaraba
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Wed, 21 Aug 2024 15:25 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ambaraba@none.nn (ambaraba)
Newsgroups: comp.os.linux.misc
Subject: Copy a file from local to network preserving timestamp
Date: Wed, 21 Aug 2024 17:25:52 +0200
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <va50u0$3tav1$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Aug 2024 17:25:53 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b47a9daf0e92a4eda65a8e11e5c31bb4";
logging-data="4107233"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181+OFCd2krNvCiZ2wtXL3RLREZ1TI+E9U="
User-Agent: Betterbird (Linux)
Cancel-Lock: sha1:B10lvb6q9xx52FDn/F3Ech7HM4M=
Content-Language: en-US
View all headers

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

Subject: Re: Copy a file from local to network preserving timestamp
From: The Natural Philosop
Newsgroups: comp.os.linux.misc
Organization: A little, after lunch
Date: Wed, 21 Aug 2024 15:40 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Copy a file from local to network preserving timestamp
Date: Wed, 21 Aug 2024 16:40:48 +0100
Organization: A little, after lunch
Lines: 25
Message-ID: <va51q0$3tq54$1@dont-email.me>
References: <va50u0$3tav1$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Aug 2024 17:40:48 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7665d9bddf1aa89590fd90bf28892d4c";
logging-data="4122788"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mF3z61gX4MPyNBbw3oBpBQzXeKgvexII="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:x7B4xiBGxNZzdWFVqLqAq4VHAU8=
In-Reply-To: <va50u0$3tav1$3@dont-email.me>
Content-Language: en-GB
View all headers

On 21/08/2024 16: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

rsync copies my date info???

--
“when things get difficult you just have to lie”

― Jean Claud Jüncker

Subject: Re: Copy a file from local to network preserving timestamp
From: Lew Pitcher
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Wed, 21 Aug 2024 16:05 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.os.linux.misc
Subject: Re: Copy a file from local to network preserving timestamp
Date: Wed, 21 Aug 2024 16:05:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <va538n$3tmst$1@dont-email.me>
References: <va50u0$3tav1$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Aug 2024 18:05:43 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c9a28afc9628ccd5be95dbcdafed347e";
logging-data="4119453"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18nbIpehGS2pUmnOJFLe2X+2yXK9lIArKc="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:DUuVv00NZEBw8OiShoe/Pe637JI=
View all headers

On Wed, 21 Aug 2024 17:25:52 +0200, 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 ..."
> preserving the original creation date.

To summarize, you want to use Linux tools to copy a file from a (Windows)
NTFS directory to a (Windows-compatible) CIFS directory, preserving the
(Windows) "creation date" metadata.

While some Linux filesystems support "file creation date", most follow the
Unix metadata requirements and do not. Linux tools are very rarely built to
know about non-standard metadata, and don't adjust things like "creation
date". AFAIK, the Linux vfs (that mediates file accesses to the variety
of supported Linux filesystems) doesn't easily carry that metadata, nor
do the standard file metadata syscalls.

In all, you are looking for a very unique and very rare utility, and I
doubt that most general-purpose Unix or Linux file copy tools will satisfy
your need.

HTH
--
Lew Pitcher
"In Skills We Trust"

Subject: Re: Copy a file from local to network preserving timestamp
From: ambaraba
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Wed, 21 Aug 2024 17:04 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ambaraba@none.nn (ambaraba)
Newsgroups: comp.os.linux.misc
Subject: Re: Copy a file from local to network preserving timestamp
Date: Wed, 21 Aug 2024 19:04:49 +0200
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <va56nh$3uggc$1@dont-email.me>
References: <va50u0$3tav1$3@dont-email.me> <va538n$3tmst$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Aug 2024 19:04:49 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b47a9daf0e92a4eda65a8e11e5c31bb4";
logging-data="4145676"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19eqxWegt3gQ+oDNn8Bvlr0XWGWfbiURhQ="
User-Agent: Betterbird (Linux)
Cancel-Lock: sha1:8spOwI361O+KpwzIYhOeTUzsaL0=
Content-Language: en-US
In-Reply-To: <va538n$3tmst$1@dont-email.me>
View all headers

On 8/21/24 18:05, Lew Pitcher wrote:
> To summarize, you want to use Linux tools to copy a file from a (Windows)
> NTFS directory to a (Windows-compatible) CIFS directory, preserving the
> (Windows) "creation date" metadata.
....

> HTH

Oh yes this/you helped me a LOT.
Copying from a win machine with win utility (robocop, in my case, but
prob. there are more) solved my problem :-)
THANKS

Subject: Re: Copy a file from local to network preserving timestamp
From: 186282@ud0s4.net
Newsgroups: comp.os.linux.misc
Organization: vector apex
Date: Thu, 22 Aug 2024 04:16 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-4.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 22 Aug 2024 04:16:58 +0000
Subject: Re: Copy a file from local to network preserving timestamp
Newsgroups: comp.os.linux.misc
References: <va50u0$3tav1$3@dont-email.me>
From: 186283@ud0s4.net (186282@ud0s4.net)
Organization: vector apex
Date: Thu, 22 Aug 2024 00:16:58 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <va50u0$3tav1$3@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <VaecncAcKPEmJlv7nZ2dnZfqnPGdnZ2d@earthlink.com>
Lines: 39
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 99.101.150.97
X-Trace: sv3-Qsbes2M10A9a8boA4GUztociZ7x6Oa9BBwhCTVuoDxvADhUylAlyDO16GZ4x1ZULSDkxbqRMyNHwBYX!0bsM84WgwdKnRsnBWbAyIx9qGk33w1iwGh1ViB27VcarITaG+vRpHTvhjvjOvSPjeK2O2jGIvKGU!wUloIzRN6jMVf/K07sco
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

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 :-)

Subject: Re: Copy a file from local to network preserving timestamp
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Thu, 22 Aug 2024 05:32 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Copy a file from local to network preserving timestamp
Date: Thu, 22 Aug 2024 05:32:04 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <va6igk$a1bk$1@dont-email.me>
References: <va50u0$3tav1$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 22 Aug 2024 07:32:04 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="121cecafcfd9e311c6d841fd8b3330b2";
logging-data="329076"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QGtUYLattoGiZiI0AGUxe"
User-Agent: Pan/0.159 (Vovchansk; )
Cancel-Lock: sha1:Jh1IrP+rcI7exxvKtqSabFQInQs=
View all headers

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.

Subject: Re: Copy a file from local to network preserving timestamp
From: vallor
Newsgroups: comp.os.linux.misc
Date: Thu, 22 Aug 2024 07:09 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: vallor@cultnix.org (vallor)
Newsgroups: comp.os.linux.misc
Subject: Re: Copy a file from local to network preserving timestamp
Date: 22 Aug 2024 07:09:12 GMT
Lines: 51
Message-ID: <lio6gnFc4mtU7@mid.individual.net>
References: <va50u0$3tav1$3@dont-email.me> <va6igk$a1bk$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net uWDSokXXPteW9XEnUBwNNg9YFersKNVATllHyomkFNvp7e7bwT
Cancel-Lock: sha1:ZEJTxD6kKSecnoCl7lbOJ9/odZE= sha256:5acRD3+/fO4ZyZFTR9rMqsFUdps4rlSxm7avJ4OGVXQ=
X-Face: +McU)#<-H?9lTb(Th!zR`EpVrp<0)1p5CmPu.kOscy8LRp_\u`:tW;dxPo./(fCl
CaKku`)]}.V/"6rISCIDP`
User-Agent: Pan/0.160 (Toresk; b2470fe; Linux-6.11.0-rc4)
View all headers

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."

Subject: Re: Copy a file from local to network preserving timestamp
From: Carlos E.R.
Newsgroups: comp.os.linux.misc
Date: Fri, 23 Aug 2024 12:56 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: robin_listas@es.invalid (Carlos E.R.)
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>
View all headers

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.

1

rocksolid light 0.9.8
clearnet tor