Adding an existing file to the File records I have a unique situation where earlier in the day, a file is uploaded to the Drupal files directory for my site (through an outside service, such as SCP), and I need to index it inside the CMS so I can interface with it through the File API. What's the best approach to do this?
It may be easiest to create a special directory to receive these incoming files.
For example, if the directory is /var/www/sites/all/files/inbound then your code could do the following to scan the directory for new files and move them to the cms storage system:

  global $user;
  $new_files = (array) glob('/var/www/sites/all/files/inbound/*');
  foreach ($new_files as $filename) {
    $uri = file_unmanaged_move($filename);
    // Create a file object.
    $file = new stdClass();
    $file-&gt;fid = NULL;
    $file-&gt;uri = $uri;
    $file-&gt;filename = drupal_basename($uri);
    $file-&gt;filemime = file_get_mimetype($file-&gt;uri);
    $file-&gt;uid = $user-&gt;uid;
    $file-&gt;status = FILE_STATUS_PERMANENT;
    file_save($file);
  }


If you want to run this periodically then you can add the above to an implementation of hook_cron.