Delete unused media files in MoodleCloud

Modified on Thu, 9 Apr at 2:42 AM

You can find and delete unused media files that are unnecessarily taking up site storage space. These files are often in the Resources, Activities, Questions, and editable areas where they were originally added via the TinyMCE editor.  


Unused files often remain in Resources, Activities and Questions, when the visual content is updated or edited by using the 'delete' key on a keyboard, however, doing this changes what is displayed, but does not delete the media file from the resource and therefore the file remains on the site. These unused files can be deleted via the Media Manager in the relevant resources. 



Overview of the steps

  1. Find your files
  2. Remove unused media file/s



Step 1: Find your files


  1. Review the list of files on your site Site administration > Server > Server > Files (sample screenshot below). The files in the list are not directly accessible via this list, but it provides information about files to help you find them in your site.
    Server files list highlighting the file name, component, and action columns.

  2. The files in the list are not directly accessible via this list, but the list provides some useful information to help youlocate your files by providing the filename, size, type, component and filearea together with a "View in context" link. Using the screenshot above as an example:
    • Filename: 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.
    • Size: The list of files is sorted from largest file to smallest. This helps to identify unusually large files easily.
    • Type: File type and format, e.g. video/mp4, application/zip, image/png, application/pdf.
    • Component: Type of module or 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.
    • Filearea: 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.
    • View in context: 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).
  3. Use the "View in context" link to access the relevant course that the file is located in. 
  4. In the course you will need to manually locate which resource the specific file is in (hence a good file naming convention is useful).




Step 2: Remove unused media file/s 


  1. Find and 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 - this large field is a text editor, TinyMCE.
  3. On the TinyMCE menu, select Tools > Media manager:Book chapter editing screen highlighting the 'Media manager' option within the 'Tools' menu.  
  4. This will open the Media Manager pop-up where you can view (and manage) all associated used and unused files:File manager highlighting the unused files and the 'Delete selected files' button. 
  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 else the file is located and whether any other resources are using that file.



*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 at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article