How do I clean cached paths to modules? I foolishly did this, when updating a module:

# cd /var/www/drupal7/modules
# mv MODULE MODULE.old
# wget &lt;MODULE_URL&gt; -O - | tar xfvz -


After refreshing the module list, I still get the old module's version because, surprise, it found the MODULE.old subdirectory first. Or last. Or whatever.

I can of course do

# rm -r MODULE.old
# ln -s MODULE MODULE.old


but that's a temporary measure at best.

How do I remove these MODULE.old directories? drush cc also tries to access them and won't run if they're not there!
The best way to do this is to disable the module, remove the '.old' folder and then re-enable the module. Unless disabling the module is destructive, this is the course of action I would recommend.

Otherwise you need to call registry_rebuild, though as you've realised you can't do this from a module because your site won't bootstrap. There is drush command made just for this case which you can find at https://drupal.org/project/registry_rebuild

If none of this works, you will need to manually edit the database ; you will need to manually edit the 'system' table and clear the system cache. Not recomended.

Whichever option you go for, make a backup of your database first!