diff --git a/templates/real-from-dwd-ana/prepare_date_local.sh b/templates/real-from-dwd-ana/prepare_date_local.sh
index 86f53807990585934e91c23b2f75ae366010d416..ecbaa23ebc59a23072bd9707e40c80e4efd77bfc 100644
--- a/templates/real-from-dwd-ana/prepare_date_local.sh
+++ b/templates/real-from-dwd-ana/prepare_date_local.sh
@@ -45,13 +45,16 @@ if [ "${IS_LOCAL}" == "True" ]; then
     rsync -v an_file.txt "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/an_file.txt"
     rsync -v fg_file.txt "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/fg_file.txt"
 
+    # Remove temporary files.
+    rm an_file.txt
+    rm fg_file.txt
 
     # Copy the first-guess and analysis files.
     rsync -v "${FG_SOURCE}" "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/${FG_FILE}"
     rsync -v "${AN_SOURCE}" "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/${AN_FILE}"
 
     # Change permissions to read only.
-    ssh "${HPCUSER}@${HPCHOST}" chmod 440 "${COMMON_DATE_FOLDER}/${AN_FILE}/*"
+    ssh "${HPCUSER}@${HPCHOST}" chmod 440 "${COMMON_DATE_FOLDER}/*"
   else
     # Create member folder and go there
     mkdir -p ${COMMON_DATE_FOLDER}
diff --git a/templates/real-from-dwd-ana/prepare_date_remote.sh b/templates/real-from-dwd-ana/prepare_date_remote.sh
index a503ae865797c5ff72a336a47f9486004b840f2d..8fec0cec09abbd5b6487628a67c43161abe78515 100644
--- a/templates/real-from-dwd-ana/prepare_date_remote.sh
+++ b/templates/real-from-dwd-ana/prepare_date_remote.sh
@@ -44,13 +44,16 @@ if [ "${IS_LOCAL}" == "0" ]; then
     rsync -v an_file.txt "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/an_file.txt"
     rsync -v fg_file.txt "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/fg_file.txt"
 
+    # Remove temporary files.
+    rm an_file.txt
+    rm fg_file.txt
 
     # Copy the first-guess and analysis files.
     rsync -v "${FG_SOURCE}" "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/${FG_FILE}"
     rsync -v "${AN_SOURCE}" "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/${AN_FILE}"
 
     # Change permissions to read only.
-    ssh "${HPCUSER}@${HPCHOST}" chmod 440 "${COMMON_DATE_FOLDER}/${AN_FILE}/*"
+    ssh "${HPCUSER}@${HPCHOST}" chmod 440 "${COMMON_DATE_FOLDER}/*"
   else
     # Create member folder and go there
     mkdir -p ${COMMON_DATE_FOLDER}