What if:

  • You installed Nextcloud via Docker
  • You created files or subfolders in the Nextcloud folder of a user
    • This is also true if you’re restoring files and folders from a backup
  • You can’t see the files or subfolders in the Nextcloud web interface

Just run the following command, replacing nextcloud_app with the actual container name of your Nextcloud Docker install:

docker exec -u www-data nextcloud_app php occ files:scan --all

This is working for me, on Nextcloud version 27.0.1.