(Moodle 3.1.5) Clearing unused/old files from moodledata folder

(Moodle 3.1.5) Clearing unused/old files from moodledata folder

by Jeff Noel -
Number of replies: 2

Hi everyone,

I'm wondering if there's a way to clean the moodledata folder, like deleting old files and such.

I'm planning to copy my production server to my test server so I can migrate modifications from my Moodle development instance, but my moodledata folder is sitting at 205 Gb with 420,000 files in it. The transfer would take a while. I was okay with 120Gb, a year ago, but it seems like it's getting way too big for my community.


Whether it's removing old files from course or anything like that, I'm trying to find some ways to save a few gigabytes (or more).


I'm open to any suggestion, thanks in advance everyone.

Average of ratings: -
In reply to Jeff Noel

Re: (Moodle 3.1.5) Clearing unused/old files from moodledata folder

by Bret Miller -
Picture of Particularly helpful Moodlers

Moodle should clean up files automatically if cron is running. You should check for automatic backups to make sure they aren't just accumulating. Also, Moosh has some good tools to identify orphaned files. You can read about it in this thread: Massive Orphaned Files.

In reply to Jeff Noel

Re: (Moodle 3.1.5) Clearing unused/old files from moodledata folder

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

As above... make sure con is running and not throwing errors. 

You only need to copy the 'filedir' directory within moodledata which might also help.