# NextCloud 21 fails to retrieve previews when browsing, spawns "No such file.." logs on first try

**URL:** <https://help.nextcloud.com/t/nextcloud-21-fails-to-retrieve-previews-when-browsing-spawns-no-such-file-logs-on-first-try/110599>\
**Category:** ℹ️ Support\
**Tags:** preview\
**Created:** [March 11, 2021, 3:49pm UTC](https://help.nextcloud.com/t/nextcloud-21-fails-to-retrieve-previews-when-browsing-spawns-no-such-file-logs-on-first-try/110599 "2021-03-11T15:49:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![poisonborz](https://help.nextcloud.com/user_avatar/help.nextcloud.com/poisonborz/32/32678_2.png) [@poisonborz](https://help.nextcloud.com/u/poisonborz)\
**Post date:** [March 11, 2021, 5:37pm UTC](https://help.nextcloud.com/t/nextcloud-21-fails-to-retrieve-previews-when-browsing-spawns-no-such-file-logs-on-first-try/110599/2 "2021-03-11T17:37:05Z")

</div>

The problem was that when I wanted to regenerate previews, I simply erased the contents of appdata\_XXX/preview. Every preview file is also stored in the DB so this alone causes problems. On one hand NC will not find the previews it thought to exist, on the other PreviewGenerator will not generate new files (as it’s thought to exist as per db).

So anyone finding this issue - if you want to clear previews, either:

- delete the preview folder contents, then run `occ files:scan-app-data` - this syncs files/db
- faster/riskier: delete the contents of the DB with SQL like `delete from oc_filecache where path like 'appdata_ocpb8d7vbr73/preview/%';`

More resources:  
[https://dev.to/powerflo/nextcloud-fix-a-missing-preview-image-3ldi](https://dev.to/powerflo/nextcloud-fix-a-missing-preview-image-3ldi)

> [@Remove preview files without occ and without posix](https://help.nextcloud.com/t/remove-preview-files-without-occ-and-without-posix/31634):
>
> The ‘preview’ files folder somwhere below data dir is getting quite large. How can I clean up this folder, causing the previews to disappear, but be regenerated when necessary? I tried the following: remove the preview folder -\> this causes the previews to disappear without being regenerated, not good remove the preview folder, then run occ occ is not an option as my hosting company does not has posix tools enabled Can I, somehowe, remove the preview folder, and cleanup the database, so th…

---

_[View the full topic](https://help.nextcloud.com/t/nextcloud-21-fails-to-retrieve-previews-when-browsing-spawns-no-such-file-logs-on-first-try/110599)._
