Windows – Batch file to poll a folder for new files

batchbatch filecommand lineftpwindows

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?

Best 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.

  • Related Question