diff --git a/handlers/rsync.in b/handlers/rsync.in
index 386255ea865b990fc8e0919b7ed160e37e0533ba..c584e7f098b8e6112619a5ca52cc1a4ba551ee80 100644
--- a/handlers/rsync.in
+++ b/handlers/rsync.in
@@ -275,8 +275,15 @@ function eval_config {
     mv=move_files
   fi
 
-  excludes=`echo "$exclude" | @SED@ -e "s/^/--exclude='/g" -e "s/ /' --exclude='/g" -e "s/$/'/"`
-
+  set -o noglob
+  SAVEIFS=$IFS
+  IFS=$(echo -en "\n\b")
+  for i in $exclude; do
+     str="${i//__star__/*}"
+     excludes="${excludes} --exclude='$str'"
+  done
+  IFS=$SAVEIFS
+  set +o noglob
 }
 
 function rotate_short {