title: VBScript that Moves modified files to another folder
body: <p>Basically, I need a script to move files to another folder that have been accessed and modified.</p>
  
  <p>I'm new to scripting, so this may be a simple problem, but I'm stumped.  Here's the error I'm getting:</p>
  
  <p>Script: C:\Users\bmcwilliams\Desktop\pssitest.vbs<p>
  Line: 17<p>
  Char: 10<p>
  Error: File already exists<p>
  Code: 800A003A<p>
  Source: Microsoft VBScript runtime error<p></p>
  
  <p>The destination folder is empty, so I'm not sure what's going on.</p>
  
  <p>Below is the code I have.  It's modified from the code listed in this post:</p>
  
  <p><a href="https://stackoverflow.com/questions/7030565/how-to-move-files-from-a-directory-to-another-directory-based-on-file-size">How to move files from a directory to another directory based on file size</a></p>
  
  <pre><code>' use a default source path
  dim sourcepath: sourcepath = "C:\users\bmcwilliams\Desktop\TestUncompleted"
  
  ' use a default destination path
  dim destinationpath: destinationpath = "C:\users\bmcwilliams\Desktop\TestCompleted"
  
  dim fso: set fso = CreateObject("Scripting.FileSystemObject")
  dim sourcefolder: set sourcefolder = fso.GetFolder(sourcepath)
  
  ' loop through each file in the directory, compare size property against
  ' the limit and copy as appropriate
  dim file, count: count = 0
  for each file in sourcefolder.Files
      dim createDate: createDate = file.DateCreated
      dim modifyDate: modifyDate = file.DateLastModified
      if createDate &lt;&gt; modifyDate Then
           file.Move destinationpath
           count = count + 1
      end if
  next
  
  WScript.Echo("complete: " &amp; count &amp; " file(s) moved")
  </code></pre>
  
  <p>Any ideas?  Any input is greatly appreciated. Thanks!</p>