I am trying to take a bunch of files and turn them into nodes that link to those files in my system. Now when I say a bunch I am talking about thousands, if not tens of thousands of files. So I need a way to do this which includes using multiple directories as the source. Mainly one directory with multiple sub-directories to recurse through.
So I decided to go with the migrate module. In my module setup that creates the migration script I have a schema declared for an intermediary table. This table will hold all of the path information for each file I want to import.
I then (in the install function hook) loop through the image directory recursively and gather a list of file names and paths. Then I stick the information into the intermediary table. This table is what I then import from.
The only problem is that when mapping the file fields I am unable to figure out how to get it to get the source path from each entry. It seems to want me to specify a flat path where all the files will reside and that won't work.
Is there a way to get it to get the full source path from the intermediary table?
This is using Drupal 7 and Migrate 2.2.
Here is the mapping information I am trying. The jpg_uri field is where that source path should be coming from (I just can't seem to figure out how to make that happen).
$jpg_arguments = MigrateFileFieldHandler::arguments('',
'file_fast', FILE_EXISTS_RENAME, NULL, array('source_field' => 'jpg_name'),
array('source_field' => 'jpg_filename'), array('source_field' => 'jpg_filename'));
$this->addFieldMapping('field_image', 'jpg_uri')
->arguments($jpg_arguments);