Delete unused media files in MoodleCloud

Modified on Thu, 11 Apr 2024 at 07:35 PM

In Moodle (and MoodleCloud), content areas in Resources, Activities, Questions, and other areas in your site, that are editable with a text editor (TinyMCE and Atto), allow you to add and embed media files. Unused files from edited content in these areas can be removed via the editor too.



Media files are stored with the Resource, Activity or Question they are added to. If you delete the entire resource, the content and associated media files will all be removed.


If you update or edit content with the editor, media files can be 'removed' from visible content by using the 'delete' key on a keyboard. However, doing this does not delete the media file from the resource and therefore the file remains on the site. These unused files are listed in the media manager in the editor and can then be deleted



To remove unused media file/s via the editor: 

  1. Open the Resource, Activity, Question or relevant area within Moodle where the media file was used (for many resources "Edit Mode" will need to be on).
  2. Go to the Content/Description/Text area.
  3. On the text editor menu, open the media/file manager (these are different in TinyMCE and Atto):
    • If you're using TinyMCE, select Tools > Media manager: 
    • If you're using Atto editor, click on the 'Manage files' icon: 
  4. This will open the pop-up where you can view (and manage) all associated used and unused files: 
  5. The 'Unused files' section identifies files that are still stored but not used with the resource.
  6. Select any you wish to delete and 'Delete selected files'.

The files should be removed immediately. If they still appear on your MoodleCloud site file list (see below), please remember that the files may still be visible until cron runs to clear them up. They should be removed within a day or so. Keep in mind, if the file in question does not seem to be removed, you may need to check where that file is located and whether any other resources are using that file.



To find files on your site (to monitor and maintain your site storage):


Whether you are nearing your site storage quota or performing regular site content maintenance, you may need to review the list of files on your site. This can be found in Site administration > Server > Server > Files (sample screenshot below). 



The files in the list are not directly accessible via this list, but the list provides some useful information about files in your site by providing the filename, size, type, component and filearea together with a "View in context" link. Using the screenshot above as an example:

  • The filename provides ... yes... the file name. If your courses are large and complex, locating files can be a time-consuming task, using good file naming conventions is highly recommended, e.g. the file MC_Course_Bk_MediaMngr_scrn.png has been named to provide a description of the image content and where it is used in this site; this is better than image(3).png and image(4).png.
  • The list of files is sorted in size order from largest file to smallest. This helps to identify unusually large files easily.
  • The type of file provides the type and format, e.g. video/mp4, application/zip, image/png, application/pdf.
  • The component refers to type of Moodle component the file is stored with, e.g. mod_book (Book resource). Other examples would include mod_resource, mod_label, badges, assignsubmission_file, question, block_html, etc.
  • The filearea is where the file is stored and provides a little more information to help you find the file, e.g. the highlighted files below are located in a Chapter in a Book resource. However, you will still need to find the exact resource and location where you had originally added the file.
  • Use the link to access the relevant course that the file is located in. From here you will need to manually locate which resource the specific file is in (hence a good file naming convention is useful).


*Find out more about Working with files, File pickerRepositories and Repositories FAQ to help manage files and optimise your site storage.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article