How to keep original created/modified dates of files?

I discovered that by transferring files to the Nextcloud it changes the created / modified dates of the files to the date of the upload. Is there any way to prevent this happening? Because I would need my files uploaded(transferred with the original created/modified dates in their metadata (e.g. for specific search orperations).
As it is now (deleting the original creation/modified dates) causes a couple of unnecessary problems for me on the level of organizing my data.
Any ideas or suggestions?
Thanks
Roman

What client exactly? I fixed this for Android ages ago.

Hi Mario,
I use the standard Nextcloud client for laptop/desktop Mac OS X High Sierra.

Just looked at the code and it looks like modified time should be preserved.

See: https://github.com/nextcloud/client/blob/040507fce6851aa7f7d0b17aeedbdc20aa0143e9/src/libsync/propagateupload.cpp#L574

cc @rullzer

I am having a similar issue. I am using the web client with nextCloud 14.0.3 server on my Server.

When I upload a file, drag and drop, created/modified date of 7/16/15 today, then I download the file from nextCloud the date on the downloaded file is today’s date.

I need to have the created/modified date maintained from the original upload of 7/16/15.

By changing this date to todays date it will cause problems with some of our auditing process.

You can restore the original date from the files with exiftool…

Forgive me if I’m remembering this wrong, but isn’t EXIF something that only exists for image file types and not documents?

it works for all files…

Try this, but make an backup before.

ExifTool "-FileModifyDate<DateTimeOriginal" DIR

I am a nextCloud newbie but good at IT tech.

Where do I run this ExifTool? I have my own install of NextCloud on a shared host server.

Run this command at the console at the root of the data folder.

Hi,
I just updated Nextcloud to 15.0.2 and the problem still persist. I have this issue on internal storage and external storage (SMB). My tests are:

  1. Upload from web client > internal storage = don’t keep original created date

  2. Upload from android app (v3.4.2) > internal storage = keeps original created date

  3. Upload from iOS app (v2.22.8) > internal storage = keeps original created date

  4. Upload from web client > external storage = don’t keep original created date

  5. Upload from android app (v3.4.2) > external storage = don’t keep original created date

  6. Upload from iOS app (v2.22.8) > external storage = don’t keep original created date

The same issue is with various sync apps.
It is possible to fix this?
Thanks

1 Like

Hi,
I have the same problem. I noticed that the movie files have the correct file creation dates.

We had such a remark on the web-interface a few days ago, it was reported to the bug tracker:

The clients should act consistently, if not the best is to open a ticket on the corresponding bug tracker (I suppose keeping the original created date is the default behavior). Regarding external storage, I don’t know if it is always possible to keep the original date…

I do not know if the bug was removed in version 16. I noticed a certain regularity, so the multimedia files (films) sent along with the photos have the correct date of the performance in contrast to the pictures.

I wonder if you can do some script to update the database so that the correct date of the image / file creation is in it.

Is there any update on this - changing the date on CAD files breaks the link back to the application using them.

Using nextcloud v21.0.2.
Client is Ubuntu Nautilus using WebDAV.
Modified dates of files copied to nextcloud are replaced by date and time of copy, and created date appears as “unknown”. How to fix this?

Would be interested the know the status of this. I am having a similar difficulty using NC running on ubuntu server which also has windows/other linux clients. I had a case where my backup to B2 failed because it said the target was newer, i suspect because i had done some copying/moving around of the file on windows which potentially messed with the modified time.

Hi everyone!
The issue still exists! Anybody knows how to copy files and keep the dates? I cannot move my gallery because of this issue which is >4yo…

Hi, I know this is quite an old thread but I thought I’d reply here, since it was the first search result for me.

There does seem to be an ongoing issue with this in Nextcloud which looks to be mostly resolved in later NextCloud versions - see the entry in the bug tracker here: Consistent handling of last modified dates when copying/moving files · Issue #15192 · nextcloud/server · GitHub

I can provide a couple of extra data points here, because I’ve just tried to upload a gallery of old photos (preserving their timestamps being a necessity).

  • Drag and drop to web interface on Windows: File modified dates are preserved (possibly something that was fixed since the original post)
  • Windows Desktop client: File modified dates are preserved
  • Ubuntu Linux, Nautilus/GNOME Files WebDAV: File modified dates are not preserved

I am running NextCloud v24.0.8 and Windows desktop client v3.6. This is to “internal” storage on the NextCloud side (actually an ext4 formatted USB drive).

So for anyone looking to get the job done, who has access to a Windows machine, that looks like a good option (YMMV).