A new file in the folder event
c#, directory, events, file, file-io
Solution
Understand this class http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx and you are ready to go. It has the needed events.
Problem
Can someone please help me to understand how to build a software that run 24/7 that listen to a specific folder (ex. C:\Actions) and each time I place a new file in that folder, the software needs to read and processing it. If there isn't files in the folder the software shouldn't do nothing only to wait to the next file to come. Example of the file (action1.txt) content (1+1) The software is processing (1+1), saving the answer(2) to anther folder and delete the file(action1.txt) from the "C:\Actions\" folder. I know how to read the file and process it.. I'm having difficulty to understand how to trigger the software only when there is new file in the folder and how to run the software for 24/7 without using so much memory or causing to memory leakage… Till now I've used it in the primitive way of looping endless and each 60 sec (Sleep) I'm checking the folder for new files. That's so useless and not so effective. I'll be happy if someone can help me to understand how to make it more effective.. thank you very much