Comments on: ccFileSlinger – simple directory monitor that emails new files ... Sun, 12 Jan 2014 03:07:32 +0000 hourly 1 By: Ramesh Mon, 30 Nov -0001 00:00:00 +0000 #comment-23 Could you please explain How to handle previosuly unprocessed files.


By: Timur Mon, 30 Nov -0001 00:00:00 +0000 #comment-24 Hi,

I assume you are talking about the files that are already in the directory when the tool is started.. I think the easiest way to process those is to modify the constructor of the directory watcher to include listing existing files in the directory and calling the delegate for each of them.

The easiest probably would look something like this:

DirectoryInfo oDirInfo = new DirectoryInfo(strDirectory);
FileInfo[] oFiles = oDirInfo.GetFiles(“*.*”);
foreach(FileInfo oFile in oFiles)

Once these files are processed, go on to create a FileSystemWatcher, etc.