diff --git a/images/imap-download/run.sh b/images/imap-download/run.sh index 22872cc..700b371 100755 --- a/images/imap-download/run.sh +++ b/images/imap-download/run.sh @@ -95,10 +95,12 @@ do_attachments() { # Move the email to a temporary directory for processing mv "${filename}" "${temp_dir}"; + filepath_temp="${temp_dir}/$(basename "${filename}")" + # Unpack the attachments - munpack -C "${temp_dir}" "${filename}"; + munpack -C "${temp_dir}" "${filepath_temp}"; # Delete the original email file and any description files - rm "${temp_dir}/$(basename "${filename}")"; + rm "${filepath_temp}"; find "${temp_dir}" -iname '*.desc' -delete; # Move the attachment files to the output directory