diff --git a/fastqsplitter.wdl b/fastqsplitter.wdl
index 846193e945aa1eaebb683b280a1ce1deb4c34988..cbbb7f307595c0e4732f82e8ee9f983cb81f944f 100644
--- a/fastqsplitter.wdl
+++ b/fastqsplitter.wdl
@@ -34,9 +34,12 @@ task Fastqsplitter {
         Int cores = 1 + ceil(0.5 * length(outputPaths))
     }
 
+    # Busybox mkdir does not accept multiple paths.
     command <<<
         set -e
-        mkdir -p $(dirname ~{sep=' ' outputPaths})
+        for FILE in ~{sep=' ' outputPaths}
+            do mkdir -p $(dirname $FILE)
+        done
         fastqsplitter \
         ~{"-c " + compressionLevel} \
         ~{"-t " + threadsPerFile} \