title: How to check if a directory exists in puppet
body: <p>Trying to create an autostart directory on a rpi using puppet. It is supposed to <code>mkdir</code> only if the location doesn't exist.</p>
  
  <p>Here is the current code:</p>
  
  <pre><code>exec { "mkdir_autostart":
  command =&gt; "mkdir /home/pi/.config/autostart",
  unless =&gt; "[ -d /home/pi/.config/autostart ]",
  path    =&gt; "/usr/local/bin/:/bin/",
  }
  </code></pre>
  
  <p>Here is what I get:</p>
  
  <pre><code>err: Failed to apply catalog: Parameter unless failed on Exec[mkdir_autostart]: 
  '[ -d  /home/pi/.config/autostart ]' is not qualified and no path was specified.
  Please qualify the command or specify a path.
  </code></pre>
  
  <p>Also tried with onlyif statement, but that generated the same error. What am I doing wrong?</p>
  
  <p>EDIT:</p>
  
  <p>Added path (<code>path    =&gt; "/usr/local/bin/:/bin/",</code>) and now get:</p>
  
  <pre><code>err: /Stage[main]/auto::Sign/Exec[mkdir_autostart]: Could not evaluate: Could not find command '['
  </code></pre>