Deleting Large Files from Old Courses

Deleting Large Files from Old Courses

by Alberto Matus -
Number of replies: 2
Hello all,

Is there a way that only the large files (particularly video files - from uploaded assignments, and course material) that have been uploaded in old courses? At our school, they want to keep track of login history, assignment grades, etc but the storage has largely grown.


Average of ratings: -
In reply to Alberto Matus

Re: Deleting Large Files from Old Courses

by Ken Task -
Picture of Particularly helpful Moodlers
First, define 'old courses'.   How old?
and, what is your schools record retention requirements?

Here's what one could do ... but not recommended ...
Find all the videos that were uploaded via query of DB mdl_files table which includes the contenthash column.
Contenthash column is the actual name of the file and location in moodledata.

Example: contenthash is: asvijwqergjiewqewdhejakdled
Location: moodledata/filedir/as/vi/ and the file itself is asvijwqergjiewqewdhejakdled

Very carefully delete the file asvijwqergjiewqewdhejakdled then create a file that has no bytes in it's stead ... file asvijwqergjiewqewdhejakdled has 0 byte size.

Side affect - videos broken - never to return.

If you do that to a video that was for course content, opps!   Put it back!

It's good that you have a 'space' concern ... means your Moodle is being used!   Maybe, however, rather than something like above, how about just getting more space?

'SoS', Ken