title: Batch if file not exist create else rename
body: <pre><code>if not defined filename set filename=123.txt
  if not defined folder set folder=January
  set BASE_DIR=C:\Users\xxx\Desktop\
  
  set file=%BASE_DIR%%folder%\%filename%
  </code></pre>
  
  <p>I am having difficult time coming with algorithma to accomplish what I am trying to do.</p>
  
  <p>Every time this batch script runs   <code>filename</code> and <code>folder</code>can be different.</p>
  
  <ul>
  <li>I am trying to check if <code>file exist</code> if it does no need to do
  anything <code>goto end</code>.</li>
  <li><p>If file does <strong>NOT</strong> exist and there is a another file under that folder. I need to update that filename with given. </p></li>
  <li><p>However, there might be case where I wouldnt even have folder exist.
  In that case I need to make folder and file inside of that folder.</p></li>
  </ul>
  
  <p>Content inside file is always empty.</p>
  
  <p>I dont need code, I just need help with logic to accomplish this.</p>