diff --git a/Registry/registry2mulhtml.hs b/Registry/registry2mulhtml.hs
index 81a0d26..274d50b 100644
--- a/Registry/registry2mulhtml.hs
+++ b/Registry/registry2mulhtml.hs
@@ -4,6 +4,8 @@ import Registry.Utils
import Registry.Grammar (registry)
import Registry.Registry
+import System.Directory (createDirectoryIfMissing)
+
infile = "./language-subtag-registry"
outdir = "./registry-html"
@@ -31,6 +33,8 @@ main = do
input <- IO.hGetContents f
let theregistry = getRegistry input
foreach ["language", "script", "region", "variant",
- "redundant", "grandfathered"]
- (toHTMLFiles theregistry)
+ "redundant", "grandfathered"]
+ (\arg ->
+ createDirectoryIfMissing True (outdir ++ "/" ++ arg) >>
+ toHTMLFiles theregistry arg)