Export the media folder contents?

Topics: Administration, General
Aug 18, 2011 at 7:45 PM

I can use the Import Export module to export my text content and metadata. This lets me store my site info in source control or move a site from one server to another. However, I don't see an easy way to export the contents of the media folder. Is there a way to grab all the media files?

As a feature suggestion, how about a feature that will zip up and download the contents of the media folder. This is the complement of the Add Media features that accepts a Zip file.

Coordinator
Aug 18, 2011 at 7:51 PM

This would be a great addition for Import Export. You could create a module to import/export the media. Might be displayed as a tab in the Import/Export page. But you have to think of the limits of http too. Have you checked how it is done in other CMSs ?

Aug 18, 2011 at 10:41 PM

No, I don't know how others are doing it. I just have existing content on a development server and I'm faced with preserving it. So I'm stumbling through the challenges one at a time.

Aug 25, 2011 at 1:31 PM

Maybe you could write a wcf web service to do this, so the web service does all the work e.g. you write a module that lets you select what media you want to export and then you tell it which server it needs exporting to and you make a web service call sending the zipped media to the new server via a TCP communication channel you could use http and set the request size to maximum or if the data is too large for that you could create multiple zip files of a certain size and send them through one at a time, then you have another method on your service that receives the data through a stream and that unzips the data and copies it to the folders under media. To do a full solution it would have to handle multiple instances of orchard and multi-tenant instances as well.

The service can be hosted inside Orchard as well.

If you need examples on how to send zipped files etc through web service calls i can provide you with that, also i have written a nice wcf service host that dynamically creates and opens communication channels - its uses Unity at the minute but im sure it could be replaced with AutoFac - if you need this as well let me know.

Aug 25, 2011 at 2:09 PM

I think a simpler solution would be more in line with the current Orchard admin tools. The media admin page already lets you select files and it already presents an "Actions" drop down list with an apply button. Today, the only listed Action is Delete. Simply adding "Export to Zip" as an option would let an admin easily zip up any or all media files. The zip archive could simply be stored in the media folder itself and downloaded through the browser or accessed by URL. I'm proposing a simple extension to the current Media admin page.

As a workaround for now, I told my content team to use WGet and simply create a list of file names to download and then run Wget like:

wget -B http://orchardserver/Orchard/Media/Default/images/ -i exportlist.txt

to bring down all the images. Then zip them up on the PC and the files are ready to be copied to another server or backed up or archived or stored in source control along with text content exported through import/export module