I am migrating from Drupal 7 to Drupal 8 (8.6.9). Both the Drupal 7 and the Drupal 8 site currently run on my local machine. The migration of the public files goes well using:

  plugin: d7_file
  scheme: public
    source_base_path: 'http://www.oldsite.com/'
      plugin: get
      source: fid
      plugin: get
      source: filename
      plugin: concat
      delimiter: /
        - constants/source_base_path
        - filepath
      plugin: urlencode
      plugin: file_copy
        - '@source_full_path'
        - uri
  plugin: 'entity:file'
  required: {  }
  optional: {  }

The private files are not found using the site URL as source_base_path so I switched it to /absolute/path/to/private. However, the files are still not found.

When I check the migration messages it says File '/absolute/path/to/private/filename.png' not found for each private file. However, if I copy the path and search for the file in the terminal, it's there so the path is correct.

At first I thought it was due to spaces in the filename but it also happens with files without spaces. For completeness: there are no spaces in the path to the private directory.

Note: not all files are images, many are PDFs.

When searching for this problem I find configurations like above, so I'm out of options.


Turns out the problem was not in the Drupal code but simply a path issue. I run the Drupal 8 site inside a DrupalVM server and the migration is done relative to THAT root. So '/absolute/path/to/private/filename.png' is not with respect to the root of my computer, but with respect to the root of the DrupalVM.

The problem is solved by adding an extra synced folder to the DrupalVM that points to the Drupal 7 root:

  - local_path: /path/to/drupal8/root
    destination: /var/www/drupalvm
    type: nfs
    create: true
  - local_path: /path/to/drupal7/root
    destination: /var/www/drupal7
    type: nfs
    create: true

Then restart the server:

vagrant halt
vagrant up

In the migration file the source path becomes:

    source_base_path: '/var/www/drupal7'

Now the files are found.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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