Missing OCC command preview:cleanup

Never before used occ preview:cleanup but command seems to be missing completely in the list of valid commands from occ preview.

The use case is: trying to add preview images for HEIC and MOV files. While experimenting I thought it would be wise to be able to cleanup my mess and rebuild previews from scratch. Therefore I wanted to check the working of occ preview:cleanup

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • Hub 9 (30.0.7)
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 22.04.5 LTS
  • Web server and version (e.g, Apache 2.4.25):
    • Apache/2.4.52 (Ubuntu)
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • n.a.
  • PHP version (e.g, 8.3):
    • PHP Version 8.3.17 (Apache2 and CLI)
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • first time trying sudo -u www-data php --define apc.enable_cli=1 /var/www/cloud/occ preview:cleanup
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • n.a.
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • n.a.

Summary of the issue you are facing:

[While executing occ preview:cleanup I get ’ Command “preview:cleanup” is not defined.’ as response. This is unexpected if I understand from the docs at [https://docs.nextcloud.com/server/latest/admin_manual/occ_command.htm](https://Nextcloud Server Manual)l ]

Steps to replicate it (hint: details matter!):

Just run occ preview:cleanup or check valid commands with occ preview and see ’ cleanup’ is missing as valid command.

Response is:

  Command "preview:cleanup" is not defined.  
                                             
  Did you mean one of these?                 
      files:cleanup                          
      preview:generate                       
      preview:repair                         
      preview:reset-rendered-texts           
      sharing:cleanup-remote-storages        
      trashbin:cleanup                       
      twofactorauth:cleanup                  
      versions:cleanup                       
                                             

Log entries

n.a.

Nextcloud

n.a.

Web Browser

n.a.

Web server / Reverse Proxy

n.a.

Configuration

If needed I will provide this.

Nextcloud

If needed I will provide this.

Apps

If needed I will provide this.

The cleanup command has only been available since version 31 (Hub 10) .

Available commands for the "preview" namespace:
  preview:cleanup               Removes existing preview files
  preview:generate              generate a preview for a file
  preview:generate-all          Generate previews for all images
  preview:pre-generate          Pre generate only images that have been added or changed since the last regular run
  preview:repair                distributes the existing previews into subfolders
  preview:reset-rendered-texts  Deletes all generated avatars and previews of text and md files
1 Like

Then maybe I should migrate to NC 31? But NC31 is not an upgrade option from the Stable Channel. So should I then upgrade to NC31 from Beta channel?

Yes you can. Because version 31.0.1 is now available. Emphasis on the “0.1”. :wink:

You only need to wait until your instance suggests you to do this, i.e. your instance is automatically supplied by the stable channel.

1 Like

Looking forward to figuring out if there will also be an option to only cleanup previews of a specific age.

Just found out from a Gemini preview in Google search this feature might exist and through more thorough search, found this thread :sweat_smile:
AI is good for something after all.

1 Like