Moving Media Files Out of CMS Directory to Another Local Filesystem Directory

kentico guy asked on November 18, 2020 18:18

Kentico 12 portal

We recently switched over to deployments directly out of Azure devops and would like to be able to clear the entire CMS directory during every deployment. This requires that we move the media files out of the CMS directory. I found this post

but it's moreso a question about migrating into a cloud storage container. My question is what the easiest way to move the media files outside of the CMS directory would be, but into another FS container rather than cloud storage. What kind of gotchas might I experience when I go to move media files locally? Would I need to run a sql script to update all of the media paths or is there some built in functionality for this in the application itself?

I read this doc and it says that the pages would need to be manually updated. So is that true? or is there some other way to do this?

Recent Answers

Juraj Ondrus answered on November 19, 2020 09:29

You just need to set the path in the Settings -> Content -> Media -> Media libraries folder setting. Enter the folder location you want the system to store the files in. The location needs to be in one of the following formats:

  • physical path - for example, c:\Libraries.
  • root-relative path - for example, ~/Libraries. But this one will be inside the web root folder.
  • UNC path - for example, \< server name >\Libraries. Note that if you want to use a UNC path while hosting your media library on a different server, you need to use the CMSAllowCheckIOPermissions web.config key set to false.

Then, if you will ensure the same folder structure of the actual media libraries in the new location, you should be good to go as the FilePath in the DB table Media_File will be the same - so no need to re-import the files.

1 votesVote for this answer Mark as a Correct answer

kentico guy answered on November 19, 2020 15:33

Nice, thanks Juraj... we might need change your name to JuRock!

1 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 20, 2020 05:22

:-) thanks!

0 votesVote for this answer Mark as a Correct answer

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