I've had to bump my head into batch uploading files to a drupal installation.
Update (sep 2011) according to http://drupal.org/node/330421#comment-2806336
// Set up any other fields in the node $form_state['values']['title'] = 'My node'; $form_state['values']['body'] = 'This is the body text!'; $form_state['values']['op'] = t('Save'); $i = 0; $file_drupal_path = "path/under/files/directory/file.mp3"; global $user; // Create file object and update files table $file = new stdClass(); $file->filename = basename($file_drupal_path); $file->filepath = $file_drupal_path; $file->filemime = mime_content_type($file_drupal_path); $file->filesize = filesize($file_drupal_path); $file->uid = $user->uid; $file->timestamp = time(); drupal_write_record('files', $file); // Create $form_state array from the returned $file object $files[$i] = (array) $file; $files[$i]['status'] = 0; $files[$i]['_weight'] = $i; $form_state['values']['YOUR_FILEFIELD_NAME'] = $files; // Create a new node module_load_include('inc', 'node', 'node.pages'); $node = new stdClass(); $node->type = 'YOUR_NODE_TYPE'; drupal_execute('YOUR_NODE_TYPE_node_form', $form_state, $node);
Other solutions for lazy coders/non-coders
A more elaborate way of importing large amounts of files using batch API can be found in.
FeedAPI is first and foremost intended to import feeds from external sites, but it can just as well be used to import a static XML file of your choosing from a local server.
By exteding FeedAPI with Feed Element Mapper and using one of the mappers in one of these issues:
you might be able to have it create nodes from your custom xml.
FeedAPI is supposed to be replaced by Feeds.
If you have tried out the Feeds module, then chip in with your 2 cents here. Feeds is supposed to replace FeedAPI, but I don't know how well it is working, nor if it has the same number of modules extending its functionality as FeedAPI has.
Node Import can import nodes from CSV/TSV files. It says that CCK filefield and imagefield content may be supported.
I haven't tried it since before I started this book page, because at that time it didn't fullfill my needs.
I haven't browsed the Import/Export projects in depth, you might find a better fit for your needs there.