I am creating file entities with migrate using drush. Image files are being copied down from a remote server. I tried


If I run the migration with --update it duplicates the files, not replacing existing ones.

drush mi DAProductImages --limit="10 items" --update

When I run this first time it creates the files. Second time it adds _0 to the filenames and duplicates the files. If I rollback after first migration the files are being removed. When rolling back after the second migration only files of last batch get removed. I also tried with:


How can I make it so that I will not end up with duplicates? I have about 30000 images so I cannot afford that.

  • Have you tried FILE_EXISTS_REUSE? Commented Apr 29, 2015 at 11:55
  • Yes, I am still getting the duplicated file.
    – NickO
    Commented Apr 29, 2015 at 11:58

2 Answers 2


This solved it for me.

The documentation at this link was missing a mention that you need to use the class prefix - I just submitted an update to the Drupal Docs to make it more clear:



This works:

$this->addFieldMapping('field_document', 'field_document_uri');

Found here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.