title: Vbscript - Compare and copy files from folder if newer than destination files
body: <p>I'm trying to design this script that's supposed to be used as a part of a logon script for alot of users. And this script is basically supposed to take a source folder and destination folder as basically just make sure that the destination folder has the exact same content as the source folder. But only copy if the datemodified stamp of the source file is newer than the destination file. </p>
  
  <p>I have been thinking out this basic pseudo code, just trying to make sure this is valid and solid basically. </p>
  
  <pre><code>Dim strSourceFolder, strDestFolder
  strSourceFolder = "C:\Users\User\SourceFolder\"
  strDestFolder = "C:\Users\User\DestFolder\"
  
  For each file in StrSourceFolder
       ReplaceIfNewer (file, strDestFolder)
  Next
  
  Sub ReplaceIfNewer (SourceFile, DestFolder)
  
      Dim DateModifiedSourceFile, DateModifiedDestFile
      DateModifiedSourceFile = SourceFile.DateModified()
      DateModifiedDestFile = DestFolder &amp; "\" &amp; SourceFile.DateModified()
  
      If DateModifiedSourceFile &lt; DateModifiedDestFile
          Copy SourceFile to SourceFolder
      End if
  
  End Sub
  </code></pre>
  
  <p>Would this work? I'm not quite sure how it can be done, but I could probably spend all day figuring it out. But the people here are generally so amazingly smart that with your help it would take alot less time :)</p>