Migrating nodes with image- and textfield to file-entity with image and description What is the approach to convert existing nodes consisting of a multivalue field-collection-field (containing an image-field and a textarea-field as caption) to the file-entity which the media module uses?
Load an array of nodes, loop over the array and in this loop loop over the field collection items. For each item create a file-entity.

Something like this:

$nids = db_query("SELECT nid FROM node WHERE some condition is true")-&gt;fetchCol();
$nodes = node_load_multiple($nids);

foreach($nodes as $node) {

  foreach($node-&gt;field_collection_field[LANGUAGE_NONE] as $item) {
    $collection = field_collection_item_load($item);

    $values = array(
      'field keys' =&gt; 'field values',
      'field keys' =&gt; 'field values',
    );

    entity_create('file', $values);

  }

}


Note that is half PHP half pseudo code - copying and pasting it won't work but will guide you on the code structure and functions that you'll need.