From 90d1e798c91c06bbfad74025e4874da3d8bab35d Mon Sep 17 00:00:00 2001 From: Frederick Ding Date: Fri, 31 Jul 2015 03:33:26 -0400 Subject: [PATCH] Fix deletion and file permissions --- save-attachments.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/save-attachments.sh b/save-attachments.sh index 3dc184c..f0761bd 100755 --- a/save-attachments.sh +++ b/save-attachments.sh @@ -37,15 +37,15 @@ do rm $MAILDIR/extracted/$i/$i for z in $MAILDIR/extracted/$i/* do - cp -v $z $DESTINATION/$MSGDATE/$MSGTIME/$(basename $z) + cp -v --no-preserve=mode,ownership $z $DESTINATION/$MSGDATE/$MSGTIME/$(basename $z) rm $z done + + if [[ $DEBUG -eq 0 ]]; then + rm -fr $MAILDIR/extracted/$i/ + fi done shopt -u nullglob -if [[ $DEBUG -eq 0 ]]; then - rm -fr $MAILDIR/extracted/$i/ -fi - echo "[$(date '+%T')] Done!"