require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->dirroot . '/course/lib.php');
$id = $argv;
$course = get_course($id);
But after I ran it, errors showed up when I clicked to the category link of the deleted course. I ended up deleting that category to get rid of the error.
Trying to fix it today.
* Update Web June 4, 2014:
Add these following line to the above code:
root@mymoodle:/var/www/moodle/course# php bulk_delete.php 75
It works! So, the next thing to do is to get all the course id and delete them.
Here is the complete working script with improvement, copy it to /<moodle-root-path>/course/ to run: