VBA - find duplicate files RRS feed

  • Question

  • Hello,

    I am looking for a fast way to compare files (any extension) - to find out if the file was changed and therefore copy a backup version to a dedicated folder.

    I have found some ways that used reading the file bytes into memory and then comparing it. For large files this would be very slow.

    Then I come up with this simple solution: just compare the combination of  filename, date modified and file size.

    I am asking for your opinion: Is this solution reliable? Why would comparing bytes be better?

    Monday, November 18, 2019 4:51 PM

All replies

  • To:  jakub dusek
    re:  latest file

    On my older windows system, the file time is listed down to the second.
    I would think filename, date and time would suffice.


    Sub TestingStuff()
      Dim strPath As String
      Dim vAnswer As Variant

      strPath = "E:\Office14\Library\Special Sort.xla"
      vAnswer = VBA.FileDateTime(strPath)
      MsgBox vAnswer
    End Sub

    Some new and some older Excel programs (now free) at MediaFire...
    Download from...

    Tuesday, November 19, 2019 7:14 PM