Sunday 23 June 2019

windows - Batch file to poll a folder for new files


I want to write a batch file which is triggered whenever a new file is added to a particular folder.


I can schedule a task using schtasks. But I am looking for a solution based upon interrupt kind of thing rather than polling. Is there any other way to do this?



Answer



There is a way to do what you want, it's called iNotify on Linux/Unix, where the OS can run a script based on activity in a directory that it is "watching". Windows and Mac have similar functionality, it's called by different names.


This question on stackoverflow covers all the options for the various OSes.


JNotify is a nice option which is written in Java and can run on all OSes. It requires writing some Java code, not sure if you're looking for that sort of option.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...