#include namespace boost { namespace filesystem { void create_directories(const path& ph) { if (ph.empty()) return; // First create branch, by calling ourself recursively create_directories(ph.branch_path()); // Now that parent's path exists, create the directory if (!exists(ph)) create_directory(ph); } }}