nextcloud / nextcloud/server

Empty directories building up in the `preview` folder.

Open
#46,425 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 29-feedback bug feature: previews and thumbnails
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

https://github.com/nextcloud/server/blob/1164c762eb2c120ca0d2d8da83dfe9f925ed652f/lib/private/Preview/BackgroundCleanupJob.php#L36

This should delete empty preview directories as well.
After running a few weeks with automatic ZFS snapshots folder attached as a history (It was a bad idea),
I've got a monstrous directory structure and the cron scan constantly utilized my disk for several days(SELECT-UPDATE on the oc_filecache table).

files:cleanup didn't do anything, 0 orphaned files.

files:scan-app-data took almost 6 hours to complete:

+---------+--------+--------------+
| Folders | Files  | Elapsed time |
+---------+--------+--------------+
| 5868385 | 151476 | 05:45:49     |
+---------+--------+--------------+

So I'm now deleting empty folders manually with find . -type d -empty -delete in the preview directory.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/private/Preview/BackgroundCleanupJob.php at line 36, where preview cleanup is initiated. Trace the cleanup behavior and verify it against a preview directory containing no files. Done means empty directories under the preview folder are removed as part of cleanup, without requiring manual find commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.