title: Create unique filename by adding incremental number
body: <p>I'm trying to increment file names if a previously numbered one exists.</p>
  
  <p>For example, it should check if "Example.csv" exists. If so, the new file should be called "Example2.csv", then "Example3.csv", "Example4.csv" and so on. Here's my code so far:</p>
  
  <pre><code>$fileNum = 2
  ; The $month variable is defined earler in the script but I'll define another var for this example
  $month = "January"
  If FileExists("Emissions Log - " &amp; $month &amp; ".csv") Then
      If FileExists("Emissions Log - " &amp; $month &amp; $fileNum &amp; ".csv") Then
          $fileNum += 1
          $file = FileOpen("Emissions Log - " &amp; $month &amp; $fileNum &amp; ".csv", 1)
      Else
          $file = FileOpen("Emissions Log - " &amp; $month &amp; $fileNum &amp; ".csv", 1)
      EndIf
  Else
      $file = FileOpen("Emissions Log - " &amp; $month &amp; ".csv", 1)
  EndIf
  </code></pre>