Best way to migrate to Kentico media library with long pathes.

Targutai Yesugei asked on August 3, 2017 10:59

Hello!

I have big folder with lots of subfolders and files. I want them all appear in media library on my site. I tried to use standart Kentico API, but got an exception in MediaFileInfoProvider.SetMediaFileInfo() with message: The specified path, file name, or both are too long..

So is there better way to migrate my images to media library? May be some ootb tool?

Thanks in advance.

Recent Answers


Juraj Ondrus answered on August 3, 2017 12:18

Hi,
What is the current length of the longest path and also, where in the Kentico structure it will be? Please note that the limit is 255 characters and this is the operating system limitation, not Kentico.

Maybe you can try mapping the current location to be the media files source folder.

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on August 3, 2017 19:09 (last edited on August 3, 2017 19:09)

I assume that you are pretty much limited to FilePath column size of media_file table. It is FilePath nvarchar(900). In a given media library you have 900 chars including file name for your file path: Len('folder1/folder2/folder3/img.gif') < 900

0 votesVote for this answer Mark as a Correct answer

Targutai Yesugei answered on August 4, 2017 06:09

Hm, i tried to run my code once more, and it's worked. Strange, but i hope this error won't appear again.

Thank you!

0 votesVote for this answer Mark as a Correct answer

Kirk Smith answered on August 8, 2018 15:22

I would like to suggest you, try LongPathTool program to resolve this issue. This tool is very helpful to resolve the issue.

0 votesVote for this answer Mark as a Correct answer

Albert Brown answered on September 27, 2018 23:39

Hi there, Nice answer! Or You could also try using LongPathTool program :-)

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.