I think most of the commands have a drupal utility function (e.g. ``drupal_rmdir``)