[SOLVED] Windows Desktop Client Sync: Could not update metadata due to invalid modification time

Dear nextcloud community,
a few days ago, my windows desktop sync stopped working after working like a charm for months. It is user specific, the other users do not have any problems when synchronizing with their clients.

From my ~100000 files, i get the error “could not update metadata due to invalid modification time: 0” about 40 000x (see image)

Does anyone have a solution for this issue? I tried to uninstall the clients from all pc’s and phones, including the appdata-files. When reinstalling, I always get the same problem again. Also the same when i try to install it on a fresh machine.

Thanks a lot in advance!

Alex

image

EDIT: Installed client version 3.3.6, everything works fine again.

1 Like

I had the same issue with using client version 3.4.1.
Solved it by downgrading to 3.3.6

Hi

We had the same issue. I created a script that resolved the modification issue on the backend doing the following.

Same problems here. The problem started after 3.4.0 update. Currently there is hundreds deletet files in trash, and some of there seems to be unable to restore, because invalid modified time for …

The nextcloud supplied script does not work in snap.

Migrated from owncloud right into this issue.

Terrible.

1 Like

Same issue here. too many files and timestamp is not even 1970-01-01.

timestamp on one of the files is :

Access: 2022-03-03 12:55:30.050780811 +0100
Modify: 2022-03-03 12:55:10.546718300 +0100
Change: 2022-03-03 12:55:47.950838145 +0100
Birth: -

please solve this issue as I do not want to downgrade nextcloud to old version. this cannot be the right solution

Hello,
i used this on the server nextcloud volume

find . -type f -newermt “1969-01-01” ! -newermt “1971-01-01” -print0 |xargs -0 touch

to fix the zero epoch dates and then runned in my docker:

docker exec -it -u 33 nextcloud-docker bash

./occ files:scan --all

exit

Could take a while depeding on users/files

Hi Inalto, thank you for helping,

however I tried this already, and no files found with those timestamps. As I mentioned in my other post, all timestamps on the file is “marts 03 2022”, and the filesync still report an error.

i just tried the find command " find . -type f -newermt “1969-01-01” ! -newermt “1971-01-01”
" - without the “delete option” afterwards, and still no files found with this timestamp

Perhaps i need to mention that those files are located on an external share which is mounted using nextcloud mount option. I did run this command on the fileserver itself where the files are based and no files with this timestamp located.

This is no Solution… This is a workaround max. And the Question was to fix it for Windows Client and not for Mac… Still open.

in my case i had files to be synchronized with the server through the client (windows) and they had this error.

Using power windows shell, I used this command and changed the timestemp of all files in the folder.

Get-ChildItem -force "d:\test\*" | ForEach-Object{$_.LastWriteTime = ("3 August 2022 17:10:00")}

Solved my problem and the file was synced.

1 Like

Just use the Script provided from Nextcloud How to fix the error invalid or negative modification date · nextcloud/desktop Wiki · GitHub

If you have the FIND Problem (find: unrecognized: -newermt) just install the findutils in your docker container by

apk -U add findutils

then the find problem should be gone

it could also be necessarry to install mysql-client. just do it.

apk -U add mysql-client

with this fixes i could use the default scripts given from nextcloud. hope it will help you

My client-side solution using Windows PowerShell here
(including working on sub-directories, exception management and textual feedback).

PowerShell command for listing files with “wrong” modified-date (i.e. date is missing):

Get-ChildItem -Force -Recurse "C:\Users\michael\Desktop\test" * | ForEach-Object -Begin{$count=0} -Process{++$count} -End{"--- Count: $count (files and folders)"} { if ($_.LastWriteTime -lt (get-date 1970-01-02)){ Write-Host $_.LastWriteTime ' -> ' $_.CreationTime ' | ' $_.FullName } }

PowerShell command for updating modification date with creation date:

Get-ChildItem -Force -Recurse "C:\Users\michael\Desktop\test" * | ForEach-Object -Begin{$count=0} -Process{++$count} -End{"--- Count: $count (files and folders)"} { if ($_.LastWriteTime -lt (get-date 1970-01-02)){ Write-Host 'Process ' $_.FullName; try{ $_.LastWriteTime = $_.CreationTime; Write-Host ' -> updated to ' $_.CreationTime } catch { Write-Host ' -> ERROR!' } } else { Write-Host 'Nothing to do for ' $_.FullName } }

NOTE:

  • Replace the directory path with your directory.
  • I replace the last modified-date with creation-date since all my files had accurate creation dates and it is better to keep the file history.
  • In case your files are also missing a proper creation date, then you could use $_.LastWriteTime = (Get-Date) instead of $_.LastWriteTime = $_.CreationTime.