Remove module folder when uninstalling
To take a different angle:

It's very possible to do this, but you shouldn't. Your web server user should not have the capacity to write to the web root (except for designated folders like the public files folder). You should therefore not be able to delete module folders from code. Doing so presents a security risk to your server.

This is one of the checks the Security Review module performs, and throws up a nice big red error if it find the web server can write to such files:



I understand this might be unavoidable if you're on shared hosting, but I think it's a good piece of information to have either way.