Migrating from dropbox public folder

1 minute read

Dropbox recently removed its public folder feature, which was used to host my blog’s images. I have to figure out a solution to host and fix the paths to these images…

Dropbox announced that As of March 15, 2017 the Public folder in your Dropbox account has been converted into a standard folder. Sad, all my previous links are hosted on Dropbox, and they all become invalid URLs.

I figured that I have to use another image hosting service. After some searching online, Cloundinary seems to be a good option. One design of my hosted images are that they are organized in sub-folders under a ‘blog’ folder. This means that if I want to seamlessly convert the links, I need to preserve the folder structure too.

Cloudinary seems to suggest they support auto-creating folders. Unfortunately that does not quite work for me.


In fact, I wrote a small script to do this.

# Upload a folder to cloudinary
import os
import cloudinary
import cloudinary.uploader
import cloudinary.api

# Upload the folder in rootdir to cloudinary, preserving the file structure

  cloud_name = "<name>",
  api_key = "<your key>",
  api_secret = "<your secret>"

rootdir = 'blog'
for root, subs, files in os.walk(rootdir):
    for file in files:
            os.path.join(root, file),
            folder=root, use_filename=True,
            unique_filename=False, resource_type='auto')

With that, I did a simple sed run on all my post sources:

sed -i '' 's/<dropbox base url>/<cloundinary base url>/' *.markdown

then rake preview. Boom! All the images are shown again!