At the recent CC day some people asked about bulk deletion of users and courses.
Moodle 1.9 beta now supports bulk user operations, such as deleting, sending messages or confirming the account. You can use a filter to easily select the users you want. The Filter allows selection based on everything from name, last access, role, authentication system (manual, LDAP, etc.) to email as well as many other options. Hopefully it will be upgraded in the future to allow filtering by other user attributes such as ID number, Departments, Institution or the new attributes that can be added to users. For Bulk Deletion of courses there is a php file posted by Jeff Church which you can place somewhere in your Moodle installation and run manually to delete your courses. It takes a text file of the courses’ short names to delete, then confirms what to remove before deleting them all. I ran it recently to remove 323 courses from 2005-2006 and it removed them with no problems.
For some useful SQL queries that can be used to identify unused courses please see Some useful Moodle SQL Queries.