Timestamp differs after copying files via usb hdd

Nextcloud version: 14.0.4.2
Operating system and version: Nexcloudpi v0.67.6
Apache or nginx version: Apache/2.4.25 (Raspbian)
PHP version: PHP 7.0.32-2+0~20181015120911.4+stretch~1.gbpa6b8cf

The issue you are facing:

since i use my nextcloud for backup i clone folders from my macbook via sambashare to the cloud.
so far so good.
For a very large folder i used a different way… i cloned it to an external hdd und connected it to the raspberrypi (much faster)… then is used cp -a to preserve everything …especially the timestamp because after copying i wanted to backup changes through the sambashare.
I have on both devices the same timezone (cet) but on the raspberry the timestamps are all 2hours behind so the backup programm thinks that these are different files and start to copy everything.
what can i do?
any suggestions?
thanks in advance

You could try using the touch command via terminal, to assign the current date/time to the folder in question. I guess it messed up when you copied from your ext.hdd to the NC.

I copy something on the ext-hdd and there like on any other computer all the timestamps are the same. but when i plug it into the raspberry it shows the wrong timestamp (always two hours behind)…so copying it with cp -a doesn´t work of course when timestamps are already wrong “interpreted” on the ext-hdd… i just found out.
touch doesn´t help me since all the timestamps have to be like the ones on the source computer otherwise the backup programm will copy everything via ethernet at the next sync because it thinks these are all different files… the easiest solution would be to copy everything via ethernet but it would take days…

it´s difficult to explain and also very confusing… so here an example using the modification time.
files name is x.xxx :slight_smile:
timestamp for x.xxx on my computer is 10:00
when i copy it to the ext-hdd ist´s still 10:00:
plugging the ext.hdd into the raspberry and using “stat x.xxx” gives me 12:00 :face_with_raised_eyebrow:
copying it to my ncdata directory it becomes 9:00
reading it on my computer via samba share -> 9:00 :weary:

I did the whole thing kind of backwards…these are my results

File created on my computer -> 10:00
Copied file via nextcloud webinterface and checked via stat the time -> 10:00
Copied it to the external hd -> still 10:00
plugged the ext-hdd into my computer: -> 9:00

I forgot to add, that i copy the data from a mac to the raspberry. Do they handle time differently?
I find it unlikely but maybe…
And i tried two different methods for copying -> cp -a and also rsync -a
It would be really helpful if somebody had a hint! I don´t want to rely only on transferring data over ethernet either way…

has nobody an idea or could point me in the right direction?..

Since nobody can explain this behaviour i did a workaround and touched all files with this command:

find DIRECTORY -print | while read filename; do
touch -d “$(date -R -r “$filename”) + 1 hours” “$filename”
done

this adds one hour to the timestamps…