diff --git a/common.wdl b/common.wdl
index a780747d64497cbd8643a468a3cb0981fd9a1298..79be3870be1f1d4d932564b42a8263bce1be4ba9 100644
--- a/common.wdl
+++ b/common.wdl
@@ -102,4 +102,17 @@ task appendToStringArray {
     runtime {
         memory: 1
     }
+}
+
+task createLink {
+    File inputFile
+    String outputPath
+
+    command {
+        ln -sf ${inputFile} ${outputPath}
+    }
+
+    output {
+        File link = outputPath
+    }
 }
\ No newline at end of file
diff --git a/samtools.wdl b/samtools.wdl
index 4dd5e296a9e517eb310690feae0cff3638c30f49..249143ffa7d4215650b6b8dce6d0b2b216548d2b 100644
--- a/samtools.wdl
+++ b/samtools.wdl
@@ -21,7 +21,12 @@ task Merge {
     command {
         set -e -o pipefail
         ${preCommand}
-        samtools merge ${outputBamPath} ${sep=' ' bamFiles}
+        if [ ${length(bamFiles)} -gt 1 ]
+          then
+            samtools merge ${outputBamPath} ${sep=' ' bamFiles}
+          else
+            ln -sf ${bamFiles} ${outputBamPath}
+        fi
     }
 
     output {