Scan folder for files and return a box that says new files available

Posted on 2012-08-21
Last Modified: 2012-08-22

I am looking for a script that can scan a folder and if there are new files within a certain time frame it will pop up a message box with a statement that says, "new files have arrived" or something similar.

Thank you.
Question by:cbones
    LVL 65

    Expert Comment


    Do you want a script to constantly monitor the folder (which is resource intensive)?  Or just to check whether files have been added in the last hour?


    Author Comment


    Looking for a script to check a folder every 15 minutes and if something new came in prompt that there are new files.
    I can add a script to the task scheduler but can the script only respond if new files came in since 15 minutes before?

    Thank you.
    LVL 65

    Accepted Solution

    The task schedular isn't quite that granular, but you could have a script run every hour, for an hour (or 45 minutes more accurately) and make the check.

    See how this goes.  For testing, run it manually using
    cscript C:\Scripts\CheckFolder.vbs

    I haven't tested it at all, so hopefully it works out.



    strFolder = "C:\Temp"
    ' Specify the interval in minutes.  The script will run for one hour, checking the folder every X minutes
    intInterval = 15
    dteStartTime = Now
    dteEndTime = DateAdd("n", -(intInterval-1), DateAdd("h", 1, dteStartTime))
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    While Now < dteEndTime
    	dteLatestFile = CDate("01-01-1601")
    	For Each objFile In objFSO.GetFolder(strFolder).Files
    		If objFile.DateLastModified > dteLatestFile Then
    			dteLatestFile = objFile.DateLastModified
    			strLatestFile = objFile.Path
    		End If
    	If dteLatestFile > CDate("01-01-1601") Then WScript.Echo "Files have been added to " & strFolder & " in the last " & intInterval & " minutes."
    	WScript.Sleep intInterval * 60000

    Open in new window


    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now