Wrong timestamp on folders after rsync and files:scan

Nextcloud version (eg, 18.0.2): 20.0.0
Operating system and version (eg, Ubuntu 20.04): Debian 10
Apache or nginx version (eg, Apache 2.4.25): 2.4.38
PHP version (eg, 7.1): 7.3.19

The issue you are facing:

Hi,
I am experiencing a similar issue as reported here. Basically, scanning the files after a migration, I am able to keep the same timestamp for files but not for folders. This is showed in the nextcloud web interface. This situation creates conflict when trying to sync with the clients.

In the filesystem, however, the folder timestamp (create and modify) are correct, as showed by stat.

Is this the first time you’ve seen this error? (Y/N):
Y

Steps to replicate it:

  1. Move the files to preserve the timestamp with rsync -avihXP --info=progress2 --stats source destination
  2. change the ownership with chown -R www-data:www-data /var/www/html/nextcloud
  3. check the timestamp with stat /var/www/html/nextcloud/data/user/files (the files and the folders have the correct timestamp)
  4. run sudo -u www-data php occ files:scan --all frow within /var/www/html/nextcloud
  5. open the browser and navigate to your nextcloud instance, the folders will have the modified field set the time of the file transfer
1 Like

Hi, I met the exact same problem :

  • in filesystem, modification time is OK ;
  • in nextcloud ‘files’ app, “modification date” appears to be ctime and not “modification date”, thus it displays wrong info