Somehow multiple courses (30 plus) have ended up with duplicated legacy course files from one course - Am I correct in thinking I will have to delete them one by one in each course? I don't know how this happened and need to backup and restore them without the legacy course files.
Don't forget to uncheck Legacy Files in Course Settings before you back up!
If course backups were from older moodles legacy setting was probably present ... no warning on restore. And once a course was in legacy it was in legacy forever ... only fix ... redo every module. But then someone offered a plugin called 'poof' ... an editor addon ... but same issue in that one had to visit each module that had legacy and use the 'poof' button in the editor to 'tag' that resource in 'draft' ... which later via cron/whatever would be move to 'something normal'. (for lack of known 'technical term').
I discovered what poof was doing and, like others, didn't wanna have to visit each to fix, instead a way to get as many as I could to 'draft'. Thus, created something I call 'clipoof'.
Can read about it:
and acquire by changing the end of above URL to:
Script requires sed and tar - so linux only.
And one has to have a backup .mbz file (the one in legacy) to work with + space enough to do what it does.
Once converted, backup file whose name has now changed, used in a restore process.
So that one doesn't have to do a lot of downloads only to turn around and upload, one could set up a clipoof file system repo where the scripts and .mbz files would reside to make it easier to restore to server.
While I have tested and used ... it works on my systems ... offered as is ... but don't mind someone asking questions about it.
I would just bite the bullet and rid the original course of legacy files and then empty the legacy files directory forever. Otherwise its like sleeping knowing there is cockroach somewhere in the room. Perhaps you have a reason to not do that.
FWIW I am the one that made "poof" .. its here:
Thanks for creating 'poof' ... used it ... worked like a charm.
Both of us are having to try and re-collect those days of old ..
From what I re-call, if one turned off Legacy Files in a course, that would not hide/remove resources/links to files etc. in the course itself ... thus would be included in the backup file.
I my test of clipoof, ran clipoof on a backup that had legacy files, restored that course with the clipoof backup .mbz file. Course restored just fine but present in course admin menu was the link for Legacy files. Turning off was ok to do with that course because it really wan't using Legacy files. Everything did work with it off.
Agree that it is worth biting the bullet and getting courses out of legacy ... by whatever means.