I have a folder which has many files. Files are continually being dropped into this folder from an external process.
I need to pick up each file one at a time and process them.
I was going to use GetFiles() but discovered EnumerateFiles() which seems better since it doesn’t wait on the string array being fully populated before being able to work with the contents.
Will EnumerateFiles be able to cope with the fact that new files will be getting written to this folder continually? How will it behave?
My processor will work as a Windows Service and so when it gets to the end of the files in the Enumerable, it will then run again x seconds later.
You could use a file system watcher:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
And listen to a
ChangedorCreatedEvent.