How to Clean Up Unused Images on Moodle Pages Before Exporting
When you’re building a course in Moodle, there’s something you might not realize:
Any images or files you upload to a Moodle page remain attached to that page — even if you delete them from the content.
In other words, if you upload images while developing your course and later remove some of them from the page content, those files don’t automatically disappear from the backend. They stay stored with the page. This can lead to a lot of unnecessary files being included when you export your course, taking up extra space and cluttering your export package. The worst part? These unused images are invisible to users but still very much part of your course files.
Fortunately, Moodle gives you a simple way to manage and remove these unused files. Here’s how you can clean things up before exporting your course:
A Quick Example
Let’s say you have a Moodle 4.0 page where you’ve uploaded three images.
In my case, I uploaded:
- A photo of my band (featuring a couple of friends and my daughter),
- A promotional image for a single we released called Wonderlust (which, by the way, hit the Top 10 of the European Songwriting Competition),
- A photo from one of our tours in Germany back in 2018.
Now, let’s say I want to remove one of those photos — maybe an older one that’s no longer relevant.
Step 1: Check the Existing Files
Before deleting anything from the page, it’s useful to know what files are currently attached to it.
Look for the Manage Files icon (it looks like a file manager).
Clicking it will show you all files connected to that specific page — not just images, but also any documents like Word files you may have linked.
In our example, all three images are listed there.
Step 2: Delete the Image from the Content
Next, I simply delete the unwanted image from the page content.
At first glance, you might assume that removing it from the visible page also deletes it from the files behind the scenes.
But it doesn’t.
After deleting the image and saving the page, if you go back to the Manage Files section, you’ll notice all three images are still there.
However, the deleted image will now be flagged as an unused file.
Step 3: Remove Unused Files
Here’s the important part:
- Go to Manage Files.
- Find the image listed under Unused files.
- Tick the checkbox next to it.
- Click Delete selected files.
Now, only the images you’re actually using on the page remain attached to it.
After saving the changes and checking again, you’ll see the file manager only lists the images still visible on the page.
Why This Matters
Imagine if you had uploaded 30 photos during course development but only kept 10 for the final version.
Without cleaning up, your course export would still carry all 30 photos — bloating your file size and making the course harder to manage for yourself or anyone else using it.
Taking a few minutes to remove unused files makes your Moodle course:
- Lighter,
- More efficient,
- Easier to transfer and archive.
Always clean up before exporting a course. Your future self (and your students) will thank you.
Bonus Tip:
While you’re there, make sure to check out my band too — we’ve had some great times touring and recording music like Wanderlust!