title: How to make a path variable with a space in the name work in a maildrop filter config file?
body: <p>I'm having troubles getting a variable which is set to <em>a path with a space in the name</em> to behave correctly.</p>
  
  <p>In <code>maildrop</code> I want all my Mails that doesn't match the rules (in this example only "Hold") to be move to the archive folder "1. Archive".</p>
  
  <p>Here is my mailfilter configuration.</p>
  
  <pre><code>## FILING RULES for "$HOME/Maildir/.1 Archiver.Filer"
  
  #### Hold
  if (/^From:.*test\@gmail\.com*/:h || \
  /^Subject:.*Archive Filer Test.*/:h)
  {
    TESTDIR="$HOME/Maildir/.Test"
    exception {
    # File mail in test folder
    cc "$DEALSDIR"
    # Mark mails in the folder as read
    `for x in ${TESTDIR}/new/*; do [ -f $x ] &amp;&amp; mv $x ${TESTDIR}/cur/${x##*/}:2,S; done`
    `for x in ${TESTDIR}/cur/*:2,; do [ -f $x ] &amp;&amp; mv $x ${TESTSDIR}/cur/${x##*/}S; done`
    to "/dev/null" 
    }
  }
  #### Archive everything else
  if  (/^From:.*/:h)
  {
    ARCHIVEDDIR="$HOME/Maildir/.1 Archive"
    exception {
    cc "$ARCHIVEDDIR"
    `for x in ${ARCHIVEDDIR}/new/*; do [ -f $x ] &amp;&amp; mv $x ${ARCHIVEDDIR}/cur/${x##*/}:2,S; done`
    `for x in ${ARCHIVEDDIR}/cur/*:2,; do [ -f $x ] &amp;&amp; mv $x ${ARCHIVEDDIR}/cur/${x##*/}S; done`
    to "/dev/null"
    }
  }
  </code></pre>
  
  <p>The problem is the "#### Archive everything else" part. I tried (a) putting the variable in quotes and (b) using <code>$HOME/Maildir/.1\ Archive/</code> in the mark-as-read part, but the result remains the same (maybe I missed something):</p>
  
  <ol>
  <li>The mail moves into the archive folder √</li>
  <li>It <strong>doesn't</strong> get marked as read….</li>
  </ol>
  
  <p>If I switch the name with the space with one that doesn't have a space it works.</p>
  
  <hr>
  
  <p><strong>Side note:</strong> this mail filter doesn't run on the inbox. The original plan was to <em>file away anything that I move into "1. Archive" automatically and if there is no rule to keep it in the archive folder</em>.</p>
  
  <p>Since I couldn't come up with a bash script that ignores files that were already matched I created a separate imap folder for filing (the "filer" dir). I pipe the contents of archive to my filing filter for maildrop with this bash script:</p>
  
  <pre><code>#!/bin/bash
  cd /home/pattulus/Maildir/.1\ Archive.Filer/cur/;
  if ls ./* &gt; /dev/null 2&gt;&amp;1
  then
      echo "There are files in that directory!"
      echo  "Filing archived Mails…"
      for MAILFILE in * ;
          do maildrop /home/pattulus/.mailfilter-archive &lt; $MAILFILE &amp;&amp; rm -f $MAILFILE ;
      done
      echo "-----------"
      echo "All Mails filed."
  else
      echo "There are no files in that directory"
  fi
  </code></pre>