How to force Nextcloud to regenerate a preview

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 25.0.1
Operating system and version (eg, Ubuntu 20.04): Docker container linuxserver/nextcloud
Apache or nginx version (eg, Apache 2.4.25): nginx/1.20.2
PHP version (eg, 7.4): PHP 8.0.25
Host OS : Synology DSM 7.1.1-42962 Update 1
Host Machine : `DS918+ Intel Celeron J3455"

The issue you are facing:

I would like to regenerate a few preview for a file as it is distorted when it was generated by imaginary. I just want to regenerate a few by GD. I know I can regenerate all previews by

  1. delete the folder [NC data root]/appdata_????/preview
  2. run occ files:scan-app-data
  3. run occ preview:generate-all

But there are thousands of previews. I don’t want to regenerate all again. Not all of them are bad.
Is it possible to locate the preview of a particular file? I know the last folder of preview is the fileid column of filecache table. However, I cannot deduce the 7 hexadecimal folders before it. Could someone enlighten me how to generate them? Therefore I can delete the related folders alone and regenerate the previews by step 2 and 3 above.

Or is there an easier way?

Thank you in advance.