[SOLVED] File/Image migration from 3.6 to 4.2 - ERROR [Emergency]: Uncaught League\Flysystem\Exception: Impossible to create the root directory

Silverstripe Version: 4.2

ERROR [Emergency]: Uncaught League\Flysystem\Exception: Impossible to create the root directory “projectfolder\public\assets.protected\Folder/Subfolder/5ba302131a5b8.”.
IN GET dev/tasks/MigrateFileTask
Line 113 in projectfolder\vendor\league\flysystem\src\Adapter\Local.php

I try to migrate files and images from SS3.6 to SS4.2. I copied and pasted my asset folders from 3.6 to public/assets and then I tried different suggestions to get them to work there:

  1. I added the
    SilverStripe\Assets\Flysystem\FlysystemAssetStore: legacy_filenames: true
    into my mysite.yml (Was this the wrong place?) - It didn’t work.

  2. I ran the
    php vendor/silverstripe/framework/cli-script.php dev/tasks/MigrateFileTask
    , but then I got the error message above. None of the files were protected in SS3.6, so I don’t know why this wants to create them in the protected folder. I copied all files on the same level as the .protected folder is.

Thank you very much.

Just had a go at replicating this issue and didn’t manage to.

That path in the error message looks somewhat weird projectfolder\public\assets.protected\Folder/Subfolder/5ba302131a5b8. You should have a / between assets and .protected. So it might be that there’s a trailing slash that is missing from somewhere.

You have a mix of backslash and forward slash in the error message … so I guess you are running this on a Windows box?

Also, if you enable legacy_filenames in one line as you did in the example, you’ll get a malformed YML error. I presumed you actually have it looking like this in mysite.yml:

  legacy_filenames: true

Hi MaximeRainville,

Yes, my mysite.yml looks like yours, it was just a matter of not formatting it correctly in the post and yes, you are right, I run this on Windows 10.

The error message produced this weird projectfolder\public\assets.protected\Folder/Subfolder/5ba302131a5b8.
As I mentioned I had no protected files in the original version. Now it kind of copied the folder and subfolder structure into the projectfolder\public\assets “.protected” (that’s the folder name created by the installation with the ". ") folder, but can’t seem to copy the actual files.

Edit: I had to delete a folder which had some weird subfolder. After that the
php vendor/silverstripe/framework/cli-script.php dev/tasks/MigrateFileTask
ran, but when I now try to open a pdf, I get the following error - Invalid file format:

Not sure what went wrong after running the MigrateFileTask, but when I deleted my public/assets folders and files and copied and pasted them again, they all work.