[NC 24.0.0-docker] occ files:cleanup / files:scan NOT cleaning up deleted files


I have the following setup:

  • docker
  • separate containers for nextcloud and mariadb
  • slightly customized mariadb/nextcloud base images from github/nextcloud
  • Reverse Proxy(apache) from outside

The instance setup is fine. The only thing that does not work is the following:

I’d like to delete the template files for the default admin automatically. When I delete the files from disk, the UI still shows the files.

I did the following to accomplish that:

  • I’m deleting the skeleton files for the default admin(because I want them gone)
  • I’m using occ files:scan --all to refresh the database
  • I had also used occ files:cleanup to delete the file-cache(before and after the prior command)

The output of occ files:scan --all is:

sudo -u www-data php -d memory_limit=512M ./occ files:scan --all 
Starting scan for user 1 out of 1 (nxadmin)
| Folders | Files | Elapsed time |
| 0       | 0     | 00:00:00     |

The output of occ files:cleanup is:

sudo -u www-data php -d memory_limit=512M ./occ files:cleanup       
0 orphaned file cache entries deleted
0 orphaned mount entries deleted

Both above methods do not work. When I log in as the nextcloud admin, the files are shown to be there and when I click on it, I get error messages(because the files are deleted).

The only thing that works, is to directly connect to the mariadb-server and delete the contents of the table oc_filecache.

Is there anything more I have to do? or which I can do besides of directly manipulating the database? I’d rather like to avoid to directly manipulate the db, because it seems to be cleaner by using occ.

Thanks for any hint!

Well. Did not work as suspected. The instance throws errors when navigating to the “files” app. So currently I better not delete the existing files of the nextcloud admin. Without deleting the files it works normally.

Ok. Functioning workaround is in place: I’m deleting the files via curl over WebDAV:

delete_admin_skeleton_files() {

        local user="$1"
        local pass="$2"

        for item in 'Nextcloud.png' 'Nextcloud%20intro.mp4' \
                    'Nextcloud%20Manual.pdf' 'Readme.md' \
                    'Reasons%20to%20use%20Nextcloud.pdf' \
                    'Templates' 'Photos' 'Documents';do
                $CURL -X DELETE --user "$user:$pass" \