Hi all,
Thanks for your feedback.
I now understand that external directory is meant to be some kind of offline backup. So it should not be deleted when the course is deleted.
A better approach could be to add a task to the automatic backup script which would delete backups in external directory for deleted courses **if** configured that way by the admin.
But when thinking about it, it might be much simpler to create an independant script/plugin to do that job.
I created the bug ticket https://tracker.moodle.org/browse/MDL-48632, but knowing that Séverin would vote against, I asked to close it as not a bug :P
If we create a script/plugin, I'll let you know here.
Thanks you all for sharing your thought about it. It really helped me figure out how I should handle all this.
Regards.