Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

How to monitor a folder and execute a task?

  • 29-06-2012 01:18PM
    #1
    Registered Users, Registered Users 2 Posts: 4,228 ✭✭✭


    Is is possible on Windows Server 2008 to monitor a folder and execute a task like call a batch script to do something when a new file is detected in the folder?
    Thanks


Comments

  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 96,078 Mod ✭✭✭✭Capt'n Midnight


    you could run a scheduled batch file every 10 minutes

    if exist c:\folder\file.* call action.bat

    don't forget you have to move / rename the file or it will keep being called.


  • Registered Users, Registered Users 2, Paid Member Posts: 2,427 ✭✭✭ressem


    I'd suggest powershell scripts and
    http://gallery.technet.microsoft.com/scriptcenter/Powershell-FileSystemWatche-dfd7084b
    but whether it's suitable for you or whether you'd prefer a 3rd party app depends on...

    How rapidly does it need to run after the file change?
    What's in the batch script? Something complicated or just a file move/rename/delete or similar?
    Does it need to run as a service, so it starts automatically on boot even when no-one is logged in?
    Does the script need to be deployed to multiple computers, or is it just a one-off? (The Powershell script would have to be signed)


Advertisement