diff --git a/common.wdl b/common.wdl
index 97731d40938e255cdac7f77da92fb398b3f6b716..783408808a587e76d3611c58ee3483414330a735 100644
--- a/common.wdl
+++ b/common.wdl
@@ -34,8 +34,8 @@ task concatenateTextFiles {
     String combinedFilePath
     Boolean? unzip=false
     command {
-        mkdir -p ${combinedFilePath}
-        rm -d ${combinedFilePath}
+        set -e -o pipefail
+        mkdir $(dirname ${combinedFilePath})
         ${true='zcat' false= 'cat' unzip} ${sep=' ' fileList} \
         > ${combinedFilePath}
     }