title: How to compare if a folder exists and if it does not exist, create her
body: <p>I have the following problem, I need to create a script that compares if the directory exists and if it does not exist, create it. In the linux shell, I use the  parameter <code>-F</code> to check if the directory exists. How do I test in PowerShell?</p>
  
  <p>In Linux shell:</p>
  
  <pre class="lang-bash prettyprint-override"><code>DIR=FOLDER
  
  if [ -f $DIR ]
  then
      echo "FOLDER EXIST";
  else
      echo "FOLDER NOT EXIST";
      mkdir $DIR
  fi
  </code></pre>
  
  <p>How do I make this comparison in Windows PowerShell?</p>
  
  <pre class="lang-bsh prettyprint-override"><code>$DIRE = "C:\DIRETORIO"
  
  if ( -e $DIRE ) {
      echo "Directory Exists"
  } else {
      md DIRETORIO
  }
  </code></pre>