Files that are "used in 0 places" (viewable at /admin/content/files) are not being deleted automatically by cron. They also show a status of permanent. How do I allow these files to be deleted by cron, or if not possible is there another way?

1 Answer 1


Prior to 8.4.x this was the default behavior, but a number of issues with file reference counting meant it was possible for files to get deleted prematurely (and possibly also for stale files to linger, though that's not so important). In 8.4.x the default behavior was changed. See Files that have no remaining usages are no longer deleted by default.

For completion, to answer the question it's possible to change back to the old behaviour by setting make_unused_managed_files_temporary to true in file.settings. It's clearly not recommended (that's why core doesn't use it anymore). See Dealing with unexpected file deletion due to incorrect file usage to track progress on file reference tracking.

  • 5
    Well, it's not recommended, but it was always meant as a temporary stop-gap until the underlying problems are fixed. Not being able to delete files is of course a bug problem as well. Problem is, once that stop-gap was in, nobody cared about the underlying issues anymore and those issues haven't been updated since :)
    – Berdir
    Sep 18, 2018 at 17:26
  • 1
    does that answer give a solution to the question ? i don't think so. How this behave with media module when a file media is added prior to insert it as a content entity reference? this new file has then 0 uses and it looks like it is not deleteable !!
    – Matoeil
    Jan 21, 2019 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.