Don’t forget to set the maintenance mode to “off” when you have finished:

sudo -u www-data php occ maintenance:mode --off

(1) Use Cron or AJAX to run Nextcloud background jobs

sudo -u www-data php occ background:cron

sudo -u www-data php occ background:ajax

(2) Re-Scan your Nextcloud data

For all users execute the following statement:

sudo -u www-data php occ files:scan --all -v

Or execute a dedicated job for a specific user:

sudo -u www-data php occ files:scan <username> -v

[box type=”info”]files:scan will break shares, tags, comments – you have to re-enable them afterwards[/box]

(3) Cleanup Nextclouds filecache

sudo -u www-data php occ files:cleanup

(4) Remove deleted files

sudo -u www-data php occ trashbin:cleanup <username>

or don’t enter any username to cleanup all deleted files. In addition you may enhance the config.php either (‘trashbin_retention_obligation’ =>”):

auto – standard behaviourD, auto – change the minimum days a file is kept with standard behaviourauto, D – delete after a number of days, but earlier if space is requiredD1, D2 – do not delete before, but definitely delete after a certain number of daysdisabled – disable automatic deletion

'trashbin_retention_obligation' => 'auto, 7',

↑ Automatically delete files after 7 days, but earlier if space run low.