Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There are similar questions for Linux and Mac, but I'm after a Windows solution here.

The problem is as follows: I want to write several (js) script files in a folder, and have a program monitor that folder for file changes and new files being added, and run a command whenever that happens (to compile them all into one single file).

The solution has to:

  1. Monitor both file changes and new files being added, in a folder.
  2. Run a command only if there is any change.

It would be best if it either is a built-in solution (like a JScript or VBscript snippet), or something that does not require installation.

share|improve this question
add comment

6 Answers

up vote 3 down vote accepted

There's a program called Belvedere that might do the trick.

http://ca.lifehacker.com/341950/belvedere-automates-your-self+cleaning-pc

It's a stand alone Windows app that runs in the background.

I've set it up to monitor my downloads folder for files with certain extensions with last modified dates of a day old. The files it finds, it deletes, however you could have it run an action instead.

share|improve this answer
    
Wow - that one looks super nice. I'll choose this as an answer (even if I already got what I needed from another one) since it probably is much more useful and versatile than the one I'm using, for other people (and maybe me in the future!). +1 and accepted! –  Camilo Martin Aug 31 '12 at 15:07
    
Belvedere made me lose hours to eventually figure out it's full of unsolved bugs, especially with custom commands. Try FolderMonitor instead (and use "{0}{1}" in the parameter field, including the quotes). Only issue: you can't define a separate command for each folder. Just one, globally. –  bfred.it May 14 at 3:04
    
@bfred.it Belvedere does have its issues, but it worked for me. FolderMonitor looks like a good solution too. I think it's the one the user asking the question ended up with. –  dangowans May 14 at 18:12
add comment

I've had good success with an old program called Log Monitor. It's ancient, and long ago abandoned. But it serves the purpose pretty well.

http://www.freeware-guide.com/download/index2.html

share|improve this answer
1  
Ah, thanks. I'm currently trying out another utility, but +1! –  Camilo Martin Aug 31 '12 at 14:59
add comment

With .NET watchfolders this is really easy to code. I'm sure someone have done such a program.

Just found this gem for you http://www.guidingtech.com/9861/automate-folder-actions-windows-watch-4-folder/

share|improve this answer
    
I'm aware of how easy it is to code this in .NET - I just didn't want to. But I'm trying this one which is free, may just work too! +1 for the recommendation, that one seems nice too. –  Camilo Martin Aug 31 '12 at 15:01
add comment

I'm currently trying this app, which requires .NET, but looks like it does the job.

share|improve this answer
add comment

If you want to do a built-in solution using JScript or VBScript, then what you want to look for is file system monitoring using WMI event subscriptions. Basically you write the code to monitor a folder and preform actions when a change is detected such as:

  • __InstanceCreationEvent
  • __INstanceDeletionEvent
  • __InstanceModificationEvent

...and your script runs on an interval watching for these events to occur. There are many resources, but here are some for VBScript and Powershell:

share|improve this answer
    
Thank you, this is quite nice to know :) –  Camilo Martin Sep 19 '12 at 9:13
add comment

I have created a simple utility for this purpose: https://github.com/benblamey/when_changed

usage: when_changed (file path) (command) (optional-parameters)

e.g. when_changed C:\somedir\foo.txt myapp.exe bar wibble 123

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.