How to regenerate previews?


I got a problem with the previews in my Nextcloud 16 instance.

Older previews aren’t shown, only new images are shown as previews.

how can i regenerate the old previews? is it possible to use any occ command or should i delete all old previews in the appdata folder?



This removes the previews from the old preview location that was used before Nextcloud 11. That has some issues. Note that the gallery shipped with Nextcloud 11 did not yet use this location. So you might want to run it again with Nextcloud 12.

preview:generate-all [user-id]

Loop over all files and try to generate previews for them. If user-id is supplied just loop over the files for that user.


Do the actual pregeneration. This means only for new or modified files (since the app was enabled or the last pregeneration was done).

Simplest is to do:

occ preview:generate-all -v

This will take a long time if you have many files. You can limit to specific paths too like this:

 occ preview:generate-all --path="yourusername/files/somefolder/" -v
1 Like

I tried that, but there comes the following error Message.

" [Symfony\Component\Console\Exception\NamespaceNotFoundException]
There are no commands defined in the “preview” namespace. "

If I use occ preview, there is written in the console “Command “preview” is not defined”

The Previewgenerator does not work because of the encryption module I use.

Do you have the previewgenerator app installed?

But you are right. If you have encryption enabled I do not think it will work. :slightly_frowning_face:

I tried it, but then I see the encryption problem.

But its curious, why isn’t there occ command “preview”? I’ve read about it in some other threads, but in my nextcloud the error message appears.

Is there no workaround for recreate the thumbs from the preview?

:thinking: I think using encryption and previews at the same time is counter-productive because it could leak information from secured content.

Ideally the previews should also be encrypted for each user. Is that doable?