title: Drupal 7 - How to use objects
body: <p>I'm trying to figure out how to leverage drupals native functions to copy a folder to a destination. I've found the class called <a href="http://api.drupal.org/api/drupal/includes--filetransfer--filetransfer.inc/function/FileTransfer%3a%3acopyDirectory/7" rel="nofollow">FileTransfer</a>, which has a method called copyDirectory. The problem is that the FileTransfer class is abstract and I can't figure out how to reach that method.</p>
  
  <p>Here's the code I'm using</p>
  
  <pre><code>&lt;?php
  function generator_form_submit($form, $form_state) {
  
    $modules_folder = 'sites/all/modules/custom/';
    $model_folder = drupal_get_path('module', 'generator') . '/model';
  
    class transfer {
      function copy() {
        FileTransfer::copyDirectory($model_folder, $modules_folder);
      }
    }
  
    $transfer = new transfer;
    $transfer-&gt;copy($model_folder, $modules_folder);
  }
  ?&gt;
  </code></pre>
  
  <p>This throws me the error "Call to undefined method transfer::sanitizePath()", since the method uses $this. I've tried many ways to get it working, but the code I'm posting here is the best attempt I've got.</p>
  
  <p>Does anyone know how to do this? </p>