Files directory getting out of control? Audit it!

Published February 22, 2021

If you manage a Drupal site that has constantly changing content, you may have concerns about the size and contents of the /sites/default/files/ directory. For most Drupal site maintainers, this can often be a source of anxiety, not ever really knowing what it contains and what, if any of the uploaded files are obsolete. 

Any method you utilize to solve potential issues is going to be tedious, but the Audit Files module can help make it a little less painful. This module provides several reports (generated using some user-configurable parameters) that can help you wrangle things:

Audit files module screenshot.

As an example, the "Not in database" report will show you a list of files that exist in /sites/default/files/, but are not managed (have not been uploaded via a file field) in Drupal. This list might include files directly uploaded via SFTP or some other method, so be careful what you delete, but it will definitely give you a head-start on identifying files that might be safely deleted.

If you feel that your site's files directory is a bit out-of-control, this module may be a good first step in cleaning things up.


This module is useful for content maintainers but seemingly aimed at coders who understand the innards of Drupal. It is useful but my user never touches it because, despite being semi-technical, he doesn't understand things. Nor should he ever have to understand or even hear about something like the file_usage table. As a site maintainer I don't know these innards well either and neither of us should have to learn these innards to use this tool. I think it needs a lot of UX work and usage of plain English, plus lists need image thumbnails because users want to see the images, especially when the image links are not even clickable. Tools by coders for coders have very low usefulness for content managers because files are content that doesn't belong to coders. This module seems to be in limbo.

Submitted by Grant Kruger (not verified) on Thu, 03/04/2021 - 17:33

Sign up to receive email notifications of whenever we publish a new blog post or quicktip!