Migrate files into dynamic paths I have a constant defined in my migration definition like so:

  constants:
    destination: "private://working_papers/"


There are 30,000 files that will come in as part of the migration. I would like to create directory destinations on the fly, based on source field values or whatever I want.

So:

destination: constants/destination

Would become:

destination: constants/destination/@source_field_value/@source_field_value2

This would be to reduce the raw number of files appearing in a given directory. When I try the above, nothing happens, even though the migration succeeds. The files don't go anywhere.

How can I do this? For reference, here is the field in the process section of the definition:

  field_paper_working_paper:
    plugin: file_import
    source: doc_format_url
    destination: constants/destination
    uid: 1
    rename: TRUE
You can chain a concat process plugin to your destination property so that it contains the result of concatenated source &amp; constant values:

field_paper_working_paper: 
  plugin: file_import 
  source: doc_format_url 
  destination: 
    plugin: concat
    source:
      - constants/destination
      - '/'
      - source_field_value
      - '/'
      - source_field_value
  uid: 1
  rename: TRUE