title: How to verify if a file exists in a batch file?
body: <p>I have to create a <code>.BAT</code> file that does this:</p>
  
  <ol>
  <li>If <code>C:\myprogram\sync\data.handler</code> exists, exit;</li>
  <li>If <code>C:\myprogram\html\data.sql</code> does not exist, exit;</li>
  <li>In <code>C:\myprogram\sync\</code> delete all files and folders except (<code>test</code>, <code>test3</code> and <code>test2</code>)</li>
  <li>Copy <code>C:\myprogram\html\data.sql</code> to <code>C:\myprogram\sync\</code></li>
  <li>Call other batch file with option <code>sync.bat myprogram.ini</code>.</li>
  </ol>
  
  <p>If it was in the Bash environment it was easy for me, but I do not know how to test if a file or folder exists and if it is a file or folder.</p>