Comments on: ccFileSlinger – simple directory monitor that emails new files http://www.creativecodedesign.com/2010/02/03/ccfileslinger-simple-directory-monitor-that-emails-new-files/ ... Sun, 12 Jan 2014 03:07:32 +0000 hourly 1 https://wordpress.org/?v=4.7.6 By: Ramesh http://www.creativecodedesign.com/2010/02/03/ccfileslinger-simple-directory-monitor-that-emails-new-files/#comment-23 Mon, 30 Nov -0001 00:00:00 +0000 #comment-23 Could you please explain How to handle previosuly unprocessed files.

Thanks
Ramesh

]]>
By: Timur http://www.creativecodedesign.com/2010/02/03/ccfileslinger-simple-directory-monitor-that-emails-new-files/#comment-24 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)
m_oCallback(oFile.FullPath);

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

Cheers.

]]>