none
File modified Check

    Question

  • Hello everybody,

    I am looking for a script that can check if an file has been modified for the last day and report an true or false.
    can you guys help me since i have not much experience with scripting.

    thanks alot.


    Monday, April 10, 2017 12:43 PM

All replies

  • Hello everybody,

    I am looking for a script that can check if an file has been modified for the last day and report an true or false.
    can you guys help me since i have not much experience with scripting.

    thanks alot.


    This is for VB Net, not scripting.

    Assuming that's what you mean then have a look at the FileInfo class. That's a good starting point:

    https://msdn.microsoft.com/en-us/library/system.io.fileinfo(v=vs.110).aspx

    As an example:

    Private Function _ FileIsOlderThanOneDay(ByVal filePath As String) As Boolean Dim retVal As Boolean = False If Not String.IsNullOrWhiteSpace(filePath) Then Dim fi As New IO.FileInfo(filePath) If fi.Exists Then retVal = (Now - fi.LastWriteTime).TotalDays > 1 End If End If Return retVal End Function



    "A problem well stated is a problem half solved.” - Charles F. Kettering


    Monday, April 10, 2017 12:49 PM
  • Hi Lars,

    Please remember to close your thread by marking helpful post, it is very beneficial to the other communities who face the same issue.

    Thanks for your understanding.

    Best Regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 19, 2017 9:21 AM
    Moderator