diff --git a/alphaplan_fwr.py b/alphaplan_fwr.py
index df428e0c6097da32cd2720d816a73e06445c22cf..c12314314e64590de959a2c3c3e1ba4189b639f8 100755
--- a/alphaplan_fwr.py
+++ b/alphaplan_fwr.py
@@ -228,13 +228,16 @@ def generate_fwr_articles(
         )
         jsonfile_uboot_name = "alphaplan-import-uboot-{}.json".format(machine)
         jsonfile_uboot_local = os.path.join(outlocal_dir, machine, jsonfile_uboot_name)
-        jsonfile_uboot_output = os.path.join(output_dir, machine, jsonfile_uboot_name)
         with open(jsonfile_uboot_local, "w", encoding="utf-8") as jsonfile:
             json.dump(data_uboot, jsonfile, indent=4)
 
-        shutil.copyfile(
-            jsonfile_uboot_local, jsonfile_uboot_output, follow_symlinks=True
-        )
+        if output_dir is not None:
+            jsonfile_uboot_output = os.path.join(
+                output_dir, machine, jsonfile_uboot_name
+            )
+            shutil.copyfile(
+                jsonfile_uboot_local, jsonfile_uboot_output, follow_symlinks=True
+            )
         # Send data object to AlphaPlan webservice
         ap_send_json(data_uboot)
 
@@ -242,10 +245,12 @@ def generate_fwr_articles(
     # Generate a json file from the dict/list structure for debugging
     jsonfile_name = "alphaplan-import-{}.json".format(machine)
     jsonfile_local = os.path.join(outlocal_dir, machine, jsonfile_name)
-    jsonfile_output = os.path.join(output_dir, machine, jsonfile_name)
     with open(jsonfile_local, "w", encoding="utf-8") as jsonfile:
         json.dump(data, jsonfile, indent=4)
-    # Copy file to release folder as the atrifacts have already been copied
-    shutil.copyfile(jsonfile_local, jsonfile_output, follow_symlinks=True)
+
+    if output_dir is not None:
+        # Copy file to release folder as the atrifacts have already been copied
+        jsonfile_output = os.path.join(output_dir, machine, jsonfile_name)
+        shutil.copyfile(jsonfile_local, jsonfile_output, follow_symlinks=True)
     # Send data object to AlphaPlan webservice
     ap_send_json(data)